source: orange/docs/reference/rst/Orange.classification.random.rst @ 9754:060889552ecf

Revision 9754:060889552ecf, 1.2 KB checked in by gregorr, 2 years ago (diff)

Added new documentation: Orange.classification.random and Orange.preprocess.RemoveUnusedValues.

Line 
1.. index:: Random classifier
2
3.. index::
4   single: classification; Random classifier
5
6**********************************
7Random classifier (``random``)
8**********************************
9
10Random classifier (class Orange.classification.RandomClassifier) disregards
11the examples and returns random predictions. Curious enough though,
12the classifier will always predict the same class for the same example.
13Predictions can be distributed by the prescribed distribution.
14
15.. class:: Orange.classification.RandomClassifier()
16
17The following example demonstrates a straightforward invocation of
18this algorithm:
19
20.. literalinclude:: code/random_classifier.py
21
22The script always prints
23
24.. literalinclude:: code/random_classifier.res
25
26Setting classVar is needed for nicer output. Remove it and see what happens.
27
28Random classifier computes the hash value of example (equivalent to calling
29hash(ex), where hash is a Python's built-in function), masks it by 0x7fffffff
30and divides it by 0x7fffffff to get a floating point number between 0 and 1.
31This value's position in the distribution determines the class. In our example,
32random values below 0.5 give the first class, those between 0.5 and 0.8 give
33the second and the rest give the third.
Note: See TracBrowser for help on using the repository browser.