Open woochan-jang opened 1 year ago
I've just tried to run one of the stacked models from automl object, and it's throwing me this error:
code:
models_map["Ensemble_Stacked"].predict(preprocessed_X_test[model.feature_name_])
error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[310], line 1
----> 1 preprocessed_X_test["surrogate_logit"] = models_map["Ensemble_Stacked"].predict(preprocessed_X_test[model.feature_name_])
2 preprocessed_X_test["surrogate_score"] = np.exp(preprocessed_X_test["surrogate_logit"])/(1+np.exp(preprocessed_X_test["surrogate_logit"]))
File ~/anaconda3/envs/mljar/lib/python3.8/site-packages/supervised/ensemble.py:306, in Ensemble.predict(self, X, X_stacked)
303 total_repeat += repeat
305 if model._is_stacked:
--> 306 y_predicted_from_model = model.predict(X_stacked)
307 else:
308 y_predicted_from_model = model.predict(X)
File ~/anaconda3/envs/mljar/lib/python3.8/site-packages/supervised/model_framework.py:428, in ModelFramework.predict(self, X)
425 y_predicted = None # np.zeros((X.shape[0],))
426 for ind, learner in enumerate(self.learners):
427 # preprocessing goes here
--> 428 X_data, _, _ = self.preprocessings[ind].transform(X.copy(), None)
429 y_p = learner.predict(X_data)
430 y_p = self.preprocessings[ind].inverse_scale_target(y_p)
AttributeError: 'NoneType' object has no attribute 'copy'
the data is all floats, no nans or infs. Same columns as the data originally fit into the AutoML().fit function.
Hi @woochan-jang,
To load AutoML models just create AutoML
object with the same results path:
automl = AutoML(results_path=f"../logs/{MLJAR_date}/")
AutoML will load all needed models and use the best model for prediction. Just call:
predictions = automl.predict(new_data)
Computing predictions from the selected model (different than best model) will be implemented in this issue https://github.com/mljar/mljar-supervised/issues/423
Hello,
thanks for putting out this package. It seems very usable/promising.
I'm using the 0.11.5 version mljar-supervised from conda-forge. One little question: after giving it a shot, I wanted to load one of the goldenfeature-stacked model.
When I ran model.predict() on the above model, however, it asked me for the non-original features, i.e. the metafeatures and the goldfeatures. Do I need to build the pipeline myself, or is there a built-in API where I can load these types models as a whole?
I tried to select the model from the automl object below, but couldn't figure it out..
Also, this automl object seems to have no attributes set before I run the load function, so I have no idea which model it's using for predictions. (And when I run automl._models, it is missing quite a few of the models from what I have trained.)
in training versus
after loading.
thank you!