orange-multitarget / docs / rst / code / multitarget.py

import Orange
data = Orange.data.Table('multitarget-synthetic')
print 'Features:', data.domain.features
print 'Classes:', data.domain.class_vars
print 'First instance:', data[0]
print 'Actual classes:', data[0].get_classes()

majority = Orange.classification.majority.MajorityLearner()
mt_majority = Orange.multitarget.binary.BinaryRelevanceLearner(learner = majority)
c_majority = mt_majority(data)
print 'Majority predictions:\n', c_majority(data[0])

mt_majority = Orange.multitarget.chain.ClassifierChainLearner(learner = majority)
c_majority = mt_majority(data)
print 'Chain Majority predictions:\n', c_majority(data[0])

pls = Orange.multitarget.pls.PLSRegressionLearner()
c_pls = pls(data)
print 'PLS predictions:\n', c_pls(data[0])

mt_tree = Orange.multitarget.tree.MultiTreeLearner(max_depth=3)
c_tree = mt_tree(data)
print 'Multi-target Tree predictions:\n', c_tree(data[0])

clust_tree = Orange.multitarget.tree.ClusteringTreeLearner()
c_clust_tree = clust_tree(data)
print 'Clustering Tree predictions: \n', c_clust_tree(data[0])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.