orange-multitask / tests /

import Orange
from Orange.multitask import MultiTaskLearner, mtfeat

import generate_data

groups, pergroup, tasks, overlap = 10, 10, 10, 2
factors = [3,2,1,1,1]
data = generate_data.Group(groups, pergroup, factors, tasks, overlap=overlap)(pertask=50)

mean = Orange.regression.mean.MeanLearner()
mtmean = MultiTaskLearner(learner=mean)
ridge = Orange.regression.linear.LinearRegressionLearner(ridge_lambda=4)
mtridge = MultiTaskLearner(learner=ridge)
mtf = mtfeat.MTFeatLearner(max_iter=50, gamma=3., intercept=True, tol=1e-7)
mtfs = mtfeat.MTFeatLearner(max_iter=50, gamma=0.1, selection=True, intercept=True, tol=1e-7)
mtfg = mtfeat.MTFeatLearner(max_iter=50, gamma=0.1, intercept=True, tol=1e-7, groups=[
    range(i * (pergroup - overlap), (i + 1) * pergroup - i * overlap)
    for i in range(groups)])

learners = [mean, mtmean, ridge, mtridge, mtfs, mtf, mtfg]
res = Orange.evaluation.testing.cross_validation(learners, data, folds=4, store_classifiers=1)
print Orange.evaluation.scoring.RMSE(res)
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
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.