source: orange/Orange/classification/__init__.py @ 11051:04009d17e84e

Revision 11051:04009d17e84e, 1.1 KB checked in by blaz <blaz.zupan@…>, 16 months ago (diff)

new tutorial

Line 
1from Orange import core
2
3CostMatrix = core.CostMatrix
4Classifier = core.Classifier
5ClassifierList = core.ClassifierList
6Learner = core.Learner
7ClassifierFD = core.ClassifierFD
8LearnerFD = core.LearnerFD
9ClassifierFromVarFD = core.ClassifierFromVarFD
10CartesianClassifier = core.CartesianClassifier
11ClassifierFromVar = core.ClassifierFromVar
12RandomClassifier = core.RandomClassifier
13RandomLearner = core.RandomLearner
14ClassifierFromVar = core.ClassifierFromVar
15ConstantClassifier = core.DefaultClassifier
16
17class PyLearner(object):
18    def __new__(cls, data=None, **kwds):
19        learner = object.__new__(cls)
20        if data:
21            learner.__init__(**kwds) # force init
22            return learner(data)
23        else:
24            return learner  # invokes the __init__
25
26    def __init__(self, name='learner'):
27        self.name = name
28
29    def __call__(self, data, weight=None):
30        return None
31
32class PyClassifier:
33    def __init__(self, **kwds):
34        self.__dict__.update(kwds)
35
36    def __call__(self, example, resultType = Classifier.GetValue):
37        return self.classifier(example, resultType)
Note: See TracBrowser for help on using the repository browser.