source: orange/docs/reference/rst/code/reliability-basic.py @ 9875:d07bba5ba88b

Revision 9875:d07bba5ba88b, 854 bytes checked in by Matija Polajnar <matija.polajnar@…>, 2 years ago (diff)

Revert incorrect lanumek's commit which reverted to an old version of those files (along with making some useful changes which I have incorporated).

Line 
1# Description: Reliability estimation - basic & fast
2# Category:    evaluation
3# Uses:        housing
4# Referenced:  Orange.evaluation.reliability
5# Classes:     Orange.evaluation.reliability.Mahalanobis, Orange.evaluation.reliability.LocalCrossValidation, Orange.evaluation.reliability.Learner
6
7import Orange
8
9housing = Orange.data.Table("housing.tab")
10
11knn = Orange.classification.knn.kNNLearner()
12
13estimators = [Orange.evaluation.reliability.Mahalanobis(k=3),
14              Orange.evaluation.reliability.LocalCrossValidation(k = 10)]
15
16reliability = Orange.evaluation.reliability.Learner(knn, estimators = estimators)
17
18restimator = reliability(housing)
19instance = housing[0]
20
21value, probability = restimator(instance, result_type=Orange.core.GetBoth)
22
23for estimate in probability.reliability_estimate:
24    print estimate.method_name, estimate.estimate
Note: See TracBrowser for help on using the repository browser.