source: orange/docs/reference/rst/code/reliability-basic.py @ 9681:b278e50a6071

Revision 9681:b278e50a6071, 844 bytes checked in by Matija Polajnar <matija.polajnar@…>, 2 years ago (diff)

Reliability: add headers to regression test scripts.

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
9data = 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(data)
19instance = data[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.