mljar-supervised
mljar-supervised copied to clipboard
Compute predictions from selected model
Details in discussion https://github.com/mljar/mljar-supervised/discussions/421
I'll like to work on this
@asuzukosi great!
Some tips:
- You can pass model name in the
predict()method. Model name will be simply a string that is displayed in the report. - When AutoML is loading models from the disk, only models needed by the
best_modelare loaded (for speed reason). You need to ensure that model selected for prediction is loaded. In the case of Ensemble that might be several models.
Please let me know if you need more help.
hey, is this issue still open? can i work on this
hey @matrixhead!
the issue is still open, I'm assigning it to you
#460 I don't know this is the right way to do it
@matrixhead few comments:
- Have you tested the code? Did you write the unit tests? I would suggest to write unit tests. Do you have idea what units tests can be added to cover corner cases?
- I would name the argument
model_name. - When loading the model from hard drive the only models from
load_on_predictparameter inparams.jsonfile are loaded. Those are models needed be best_model. We need to assure that selected model by user is loaded. - There are
predict(),predict_proba()andpredict_all()methods. They should support themodel_nameparameter.
- no I didn't write tests, I will try to do that.
- ok
- can I do it this way, first by calling load() from _predict() and then checking user-specified model is present in the _models or not
- okay i will do that
#460
Hi @pplonski , I just opened a PR for this. I'm sure that more work would be required before we can merge it, but early feedback would be very helpful. Thanks!
Quick and dirty workaround until this is oficially implemented:
from supervised.model_framework import ModelFramework
model = ModelFramework.load("AUTOML_FOLDER_NAME_HERE", model_subpath="MODEL_FOLDER_NAME_HERE")
For regression results:
y_pred = automl._base_predict(qdqd_X_test, model=model)["prediction"].to_numpy()
For classification results:
y_pred = automl._base_predict(qdqd_X_test, model=model)["label"].to_numpy()
Hopefully i can save someones time. :D