Closed CirdanCapital closed 5 years ago
False alarm. I changed the code from:
ensemble.add(ests_1,
folds= 10,
propagate_features=[247],
proba=False)
to
ensemble.add(ests_1,
folds= 10,
propagate_features=[i for i in range(247)],
proba=False)
And now it works! I just need to change the linear regressions and I am done! Thanks again for your help yesterday and thank you for writing this library. You might want to fix the 3d input issue for Keras' LSTMs when you find time. You can close this issue. Let us know if you would like to come to our office in Knightsbridge and meet the team and I'll buy you a coffee. This is Christian from Cirdan Capital.
Hi,
I'm glad it works. A few notes:
The safe way to manipulate input data is to add a preprocessing instance to you meta-learner layer that flattens the data. In your case, overriding _propagate_features
is fine, but in general there is no way of knowing how to merge dimensions.
As stated in the documentation, the propagate_features
argument expects an iterable, such as range(247)
, or more generally a list of column ids.
You are using an LSTM, which is a sequential model, but the SuperLearner
instance uses standard cross-validation. You may want to use the temporal ensemble class.
Best of luck!
Hi Again,
I want to discuss my implementation. I have a Keras LSTM learner in the first layer. It requires that the X_test input is 3d. This is fine but it breaks my second layer as these (scikit-learn) learners require 2d input. I have consequently modified backend.py as follows:
And this works well i.e. everything works and I see the following output:
The problem now is that I go back to my previous problem in that I am looking at the learners in both:
for the second layer and 3rd and 4th learners (linear regressions) and I see that their coef_ length is only 2 and not 249 like I expected given that I am trying (see above) to propogate the 247 input to the second layer. I am trying to train the scikit-learn models on the second layer because with a 3d input it seems the only model that I can have in the first layer is the Keras model.
Please try and help me. What I really want is an ensemble with
So far, everything is working but I need to work out why these fitted 2nd layer linear regression objects have a coef array of length 2 (when I expect 249) but I know how to change them now (thanks to you) and then I think I am done. I am in London and I am happy to share my code with you. Please help!!! I really need to get this finished.