Automatminer with using neural network

When customizing pipes in automatminer, the example I see is using XGBClassifier. I would like to ask if there is a way that I can switch to a neural network for data training and how to implement it concretely.Thanks

Here are some examples from the site:
from xgboost import XGBRegressor, XGBClassifier

from automatminer import AutoFeaturizer, FeatureReducer, DataCleaner,
SinglePipelineAdaptor

autofeaturizer = AutoFeaturizer(from_preset=“production”,
cache_src="./features.json",
exclude=[“EwaldEnergy”])
cleaner = DataCleaner(max_na_frac=0.05)
reducer = FeatureReducer(reducers=(“corr”,))
learner = SinglePipelineAdaptor(classifier=XGBClassifier(n_estimators=500),
regressor=XGBRegressor(n_estimators=500))

Make a matpipe

pipe = MatPipe(
autofeaturizer=autofeaturizer,
cleaner=cleaner,
reducer=reducer,
learner=learner
)

All you need to do is specify two objects: a regressor and a classifier. Both of these must contain fit/predict syntax (as in sklearn BaseEstimator). Then you just put them in place of XGBClassifier(…) and XGBRegressor(…) in this example, if you’re just looking to use a single model.

Your underlying model can be anything, as long as it fits these specifications. For example, you can use a Keras Sequential model, sklearn MLP, etc.

The following is the simple network built by Keras. I still encountered difficulties when placing it in automatminer. I would like to ask how to operate it. I apologize for my lack of proficiency in the application of the model

Ok so generally for the SinglePipelineAdaptor you need a classifier and regressor. But if you are sure you will only be calling it with the regressor, for example, you can just use a dummy for the classifier and use your NN for the regressor.

So you would compile your model, then do:

from sklearn.dummy import DummyClassifier

nn_adapter = SinglePipelineAdaptor(regressor=model, classifier=DummyClassifier())

Or similar. I’ve just noticed unfortunately there’s no way for you to enter the extra kwargs in the pipeline (e.g., epochs=300 ), but I have opened an issue for this on github and will work on it (though it is not priority)! If you are interested in accelerating this fix, please consider contributing code!!

Thanks for your comments, which allow me to slove the problem. For the topic you mentioned, I think it seems to work with KerasRegressor(). Once I’ve made progress in this area, I’ll share it