Closed lschneidpro closed 4 years ago
Yes that's entirely possible. A simple version could look like this:
from mlens.ensemble import SuperLearner
# First, create a transform class for the target variable
class MyTrans:
def __init__(self, *args, **kwargs):
# up to you
def fit(self, X, y):
# up to you
return self
def transform(self, X, y):
y_transformed = # up to you
return X, y_transformed
def fit_transform(self, X, y):
return self.fit(X, y).transform(X, y)
# Next, create the ensemble
ens = SuperLearner(proba=True)
ens.add(estimator=classifier_1(),
propagate_features=range(num_features))
ens.add_meta(estimator=classifier_2(),
preprocessing=MyTrans())
Hope that helps, otherwise take a look at the docs of the ensembles, they contain a wealth of information about how to create layers!
I checked the documentation, but i could not figure out if i could build such system ?
thank you for your help