Skip to content

Commit

Permalink
Predictions: Add models and folds to output Results
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Feb 25, 2022
1 parent 4631d8c commit cadc612
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Orange/widgets/evaluate/owpredictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ def _commit_evaluation_results(self):
nanmask = numpy.isnan(self.data.get_column_view(self.class_var)[0])
data = self.data[~nanmask]
results = Results(data, store_data=True)
results.folds = None
results.folds = [...]
results.models = numpy.array([[p.predictor for p in self.predictors]])
results.row_indices = numpy.arange(len(data))
results.actual = data.Y.ravel()
results.predicted = numpy.vstack(
Expand Down
4 changes: 4 additions & 0 deletions Orange/widgets/evaluate/tests/test_owpredictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from Orange.base import Model
from Orange.classification import LogisticRegressionLearner
from Orange.classification.majority import ConstantModel
from Orange.data.io import TabReader
from Orange.regression import LinearRegressionLearner
from Orange.widgets.tests.base import WidgetTest
Expand Down Expand Up @@ -505,6 +506,9 @@ def test_multi_inputs(self):
def check_evres(expected):
out = self.get_output(w.Outputs.evaluation_results)
self.assertSequenceEqual(out.learner_names, expected)
self.assertEqual(out.folds, [...])
self.assertEqual(out.models.shape, (1, len(out.learner_names)))
self.assertIsInstance(out.models[0, 0], ConstantModel)

check_evres(["P1", "P2", "P3"])

Expand Down

0 comments on commit cadc612

Please sign in to comment.