Repository: biolab/orange3

Issue:
Stacking Widget: "Stack failed with an error" when using Time Slice as Data source
**What's wrong?**
When using the Stacking widget with Time Slice as Data source and Test and Score widget on the other side, a "Stack failed with an error" message appears (on the Test and Score widget).
There is no error if Data Sampler (or no widget) is used to slice the data instead the Time Slice widget.

The log shows repeated errors like this one, not sure if this is THE one:
```
TransformDomain should define __eq__ and __hash__ to be used for compute_shared
ComputeValueProjector should define __eq__ and __hash__ to be used for compute_value
or set InheritEq = True if inherited methods suffice
```

Attached is a screenshot of the problem reproduces with "ParlaMint" dataset, in order to have a time field to Time Slice with I used the From and To variables as meta:
<img width="2560" alt="image" src="https://github.com/biolab/orange3/assets/6105200/84358393-2828-4649-a32b-260a60debc84">


**How can we reproduce the problem?** 
Attached is a zip of the .ows file also appears in the screenshot (where all relevant widget windows are open):
[Stacking with Time Slice problem report.ows.zip](https://github.com/biolab/orange3/files/13557015/Stacking.with.Time.Slice.problem.report.ows.zip)

**What's your environment?**
OS: macOS 12.7
Orange version: 3.36.2
Orange installed using the .dmg in the download page



Discussion:
I'm trying to reproduce this, but cannot get to the Stacking error. However, the error that does appear in Test and Score says "Target variable has only one value." This is because in ParlaMint, the target variable is tied to the time period, so if you are using Time Slice, inevitably, you'll get only a single variable.
Thank you for replying, I was using the ParlaMint dataset just as an example to a dataset all of us have access to, the problem occurred also in other time series. I was wondering if the attached .ows throws the Stacking error on you machine.
@ereztison Just wondering what the warning message is when you hover over the yellow triangle with mouse.

EDIT: Nevermind, I figured it out. Another question though: when you click the error in Test & Score does it show the reason why Stacking failed? Like this:
![test score error](https://github.com/biolab/orange3/assets/5299789/20b66647-78ae-42e9-8745-1672fbb8645b)
@processo, please find attached an image with the Test & Score error displayed when clicked
<img width="2550" alt="image" src="https://github.com/biolab/orange3/assets/6105200/2d38d167-bd57-4ee1-9994-25ad694ee86f">


@ereztison Thanks. Pity that `assert` had no message.

Resolving patch:
diff --git a/Orange/ensembles/stack.py b/Orange/ensembles/stack.py
--- a/Orange/ensembles/stack.py
+++ b/Orange/ensembles/stack.py
@@ -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


Test patch:
diff --git a/Orange/tests/test_stack.py b/Orange/tests/test_stack.py
--- a/Orange/tests/test_stack.py
+++ b/Orange/tests/test_stack.py
@@ -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
 
@@ -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)