source: orange/docs/widgets/rst/evaluate/predictions.rst @ 11359:8d54e79aa135

Revision 11359:8d54e79aa135, 5.2 KB checked in by Ales Erjavec <ales.erjavec@…>, 14 months ago (diff)

Cleanup of 'Widget catalog' documentation.

Fixed rst text formating, replaced dead hardcoded reference links (now using
:ref:), etc.

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
18      slot
19
20Outputs:
21   - Predictions (orange.ExampleTable)
22      Original example table with added predictions
23
24
25Description
26-----------
27
28The widget gets a data set and one or more predictors (classifiers, not
29learning algorithms - see the example below). It shows a table with the
30data and the predictions made.
31
32Despite its simplicity, the widget allows for quite interesting analysis of
33decisions of predictive models; there is a simple demonstration at the end of
34the page. Note also, however, the related widget :ref:`Confusion Matrix`.
35Although many things can be done with any of them, there are tasks for which
36one of them might be much more convenient than the other.
37
38.. image:: images/Predictions.png
39
40The widget can show class predictions (:obj:`Show predicted class`) and
41predicted probabilities for the selected classes
42(:obj:`Show predicted probabilities`, the classes are selected below).
43
44By default, the widget also shows the attributes. This can be disabled by
45checking :obj:`Hide all` under :obj:`Data Attributes`.
46
47The output of the widget is another data table, where predictions are
48appended as new meta attributes. The table is output either automatically
49(:obj:`Send automatically`) or upon clicking :obj:`Send Predictions`.
50
51
52Example
53-------
54
55Here is a demonstration.
56
57.. image:: images/Predictions-Schema.png
58
59First, compare the schema with the one for :ref:`Test Learners`. Widgets
60representing learning algorithms, like :ref:`Naive Bayes` or
61:ref:`Classification tree` provide two kinds of signals, one with a learning
62algorithm and one with a classifier, that is, a result of the learning
63algorithm when it is given some data. The learner is available always, while
64for outputting a classifier, the widget representing a learning algorithm needs
65to be given some data.
66
67Test Learners tests learning algorithms, hence it expects learning algorithms
68on the input. In the corresponding schema, we gave the Test Learners some data
69from the File widget and a few "learner widgets". Widget Predictions shows
70predictions of a classifier, hence it needs a classifier and data. To get
71a classifier from the learner widget, the widget needs to be given data.
72
73This is hence what we do: we randomly split the data into two subsets. The
74larger, containing 70 % of data instances, is given to Naive Bayes and
75Classification tree, so they can produce the corresponding classifiers.
76The classifiers go into Predictions, among with the remaining 30 % of the
77data. Predictions shows how these examples are classified.
78
79The results of this procedure on the heart disease data are shown in the
80snapshot at beginning of the page. The last three columns are the actual
81class, and the predictions by the classification tree and naive Bayesian
82classifier. For the latter two we see the probability of class "1" (since
83this is the class chosen on the left-hand side of the widget) and the predicted
84class.
85
86The schema also shows a few things we can do with the data from the widget.
87First, we can observe it in a :ref:`Data Table`. It shows a similar view to
88the one in Predictions, except that the probabilities are shown as separate
89attributes, so we can sort the examples by them and so on.
90
91To save the predictions, we simply attach the :ref:`Save` widget to Predictions.
92
93Finally, we can analyze the classifier's predictions. For instance, we want
94to observe the relations between probabilities predicted by the two classifiers
95with respect to the class. For that, we first take :ref:`Select Attributes`
96with which we move the meta attributes with probability predictions to ordinary
97attributes. The transformed data is then given to the :ref:`Scatter plot`,
98which we set to use the attributes with probabilities for the x and y axes, and
99the class is (as already by default) used to color the data points.
100
101.. image:: images/Predictions-ExampleScatterplot.png
102
103To get the above plot, we added 5% jittering to continuous attributes, since
104the classification tree gives just a few distinct probabilities, hence without
105jittering there would be too much overlap between the points.
106
107The blue points at the bottom left represent the people with no diameter
108narrowing, which were correctly classified by both classifiers. The upper left
109red points represent the patients with narrowed vessels, which were correctly
110classified by both. At the top left there are a few blue points: these are
111those without narrowed vessels to whom the tree gave a high probability of
112having the disease, while Bayesian classifier was right by predicting a low
113probability of the disease. In the opposite corner, we can spot red points,
114that is, the sick, to which the tree gave a low probability, while the naive
115Bayesian classifier was (again) right by assigning a high probability of having
116the disease.
117
118Note that this analysis is done on a rather small sample, so these
119conclusions may be ungrounded.
120
121Another example of using this widget is given in the documentation for
122widget :ref:`Confusion Matrix`.
Note: See TracBrowser for help on using the repository browser.