source: orange/docs/widgets/rst/evaluate/predictions.rst @ 11050:e3c4699ca155

Revision 11050:e3c4699ca155, 5.4 KB checked in by Miha Stajdohar <miha.stajdohar@…>, 16 months ago (diff)

Widget docs From HTML to Sphinx.

Line 
1.. _Predictions:
2
3Predictions
4===========
5
6.. image:: ../icons/Predictions.png
7
8Shows the model's prediction on data.
9
10Signals
11-------
12
13Inputs:
14   - Data (ExampleTable)
15      Data to be classified
16   - Predictors (orange.Classifier)
17      Predictors to be used on the data; multiple widget can connect to this slot
18
19Outputs:
20   - Predictions (orange.ExampleTable)
21      Original example table with added predictions
22
23
24Description
25-----------
26
27The widget gets a data set and one or more predictors (classifiers, not learning algorithms - see the example below). It shows a table with the data and the predictions made.
28
29Despite its simplicity, the widget allows for quite interesting analysis of decisions of predictive models; there is a simple demonstration at the end of the page. Note also, however, the related widget `Confusion Matrix <ConfusionMatrix.htm>`_. Although many things can be done with any of them, there are tasks for which one of them might be much more convenient than the other.
30
31.. image:: images/Predictions.png
32
33The widget can show class predictions (:obj:`Show predicted class`) and predicted probabilities for the selected classes (:obj:`Show predicted probabilities`, the classes are selected below).
34
35By default, the widget also shows the attributes. This can be disabled by checking :obj:`Hide all` under :obj:`Data Attributes`.
36
37The output of the widget is another data table, where predictions are appended as new meta attributes. The table is output either automatically (:obj:`Send automatically`) or upon clicking :obj:`Send Predictions`.
38
39
40Example
41-------
42
43Here is a demonstration.
44
45.. image:: images/Predictions-Schema.png
46
47First, compare the schema with the one for `Test Learners <TestLearners.htm>`_. Widgets representing learning algorithms, like `Naive Bayesian classifier <../Classify/NaiveBayes.htm>`_ or `Classification tree <ClassificationTree.htm>`_ provide two kinds of signals, one with a learning algorithm and one with a classifier, that is, a result of the learning algorithm when it is given some data. The learner is available always, while for outputting a classifier, the widget representing a learning algorithm needs to be given some data.
48
49Test Learners tests learning algorithms, hence it expects learning algorithms on the input. In the corresponding schema, we gave the Test Learners some data from the File widget and a few "learner widgets". Widget Predictions shows predictions of a classifier, hence it needs a classifier and data. To get a classifier from the learner widget, the widget needs to be given data.
50
51This is hence what we do: we randomly split the data into two subsets. The larger, containing 70 % of data instances, is given to Naive Bayes and Classification tree, so they can produce the corresponding classifiers. The classifiers go into Predictions, among with the remaining 30 % of the data. Predictions shows how these examples are classified.
52
53The results of this procedure on the heart disease data are shown in the snapshot at beginning of the page. The last three columns are the actual class, and the predictions by the classification tree and naive Bayesian classifier. For the latter two we see the probability of class "1" (since this is the class chosen on the left-hand side of the widget) and the predicted class.
54
55The schema also shows a few things we can do with the data from the widget. First, we can observe it in a `Data Table <../Data/DataTable.htm>`_. It shows a similar view to the one in Predictions, except that the probabilities are shown as separate attributes, so we can sort the examples by them and so on.
56
57To save the predictions, we simply attach the `Save <../Data/Save.htm>`_ widget to Predictions.
58
59Finally, we can analyze the classifier's predictions. For instance, we want to observe the relations between probabilities predicted by the two classifiers with respect to the class. For that, we first take `Select Attributes <../Data/SelectAttributes.htm>`_ with which we move the meta attributes with probability predictions to ordinary attributes. The transformed data is then given to the `Scatter plot <../Visualize/ScatterPlot.htm>`_, which we set to use the attributes with probabilities for the x and y axes, and the class is (as already by default) used to color the data points.
60
61.. image:: images/Predictions-ExampleScatterplot.png
62
63To get the above plot, we added 5% jittering to continuous attributes, since the classification tree gives just a few distinct probabilities, hence without jittering there would be too much overlap between the points.
64
65The blue points at the bottom left represent the people with no diameter narrowing, which were correctly classified by both classifiers. The upper left red points represent the patients with narrowed vessels, which were correctly classified by both. At the top left there are a few blue points: these are those without narrowed vessels to whom the tree gave a high probability of having the disease, while Bayesian classifier was right by predicting a low probability of the disease. In the opposite corner, we can spot red points, that is, the sick, to which the tree gave a low probability, while the naive Bayesian classifier was (again) right by assigning a high probability of having the disease.
66
67Note that this analysis is done on a rather small sample, so these conclusions may be ungrounded.
68
69Another example of using this widget is given in the documentation for widget `Confusion Matrix <ConfusionMatrix.htm>`_.
Note: See TracBrowser for help on using the repository browser.