Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack: new table instead of transform #6723

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Orange/ensembles/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def fit_storage(self, data):
dom = Domain([ContinuousVariable('f{}'.format(i + 1))
for i in range(X.shape[1])],
data.domain.class_var)
stacked_data = data.transform(dom).copy()
stacked_data = Table.from_table(dom, data)
with stacked_data.unlocked_reference():
stacked_data.X = X
stacked_data.Y = res.actual
Expand Down
15 changes: 14 additions & 1 deletion Orange/tests/test_stack.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest

from Orange.data import Table
from Orange.ensembles.stack import StackedFitter
from Orange.ensembles.stack import StackedFitter, StackedLearner
from Orange.evaluation import CA, CrossValidation, MSE
from Orange.modelling import KNNLearner, TreeLearner

Expand All @@ -26,3 +26,16 @@ def test_regression(self):
mse = MSE()(results)
self.assertLess(mse[0], mse[1])
self.assertLess(mse[0], mse[2])

def test_timeseries(self):
def aggregate(data):
assert type(data) is Table

class CustomTable(Table):
pass

sl = StackedLearner([TreeLearner(), KNNLearner()],
aggregate=aggregate)

data = CustomTable(self.iris)
sl(data)
Loading