Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How could I load a specific model from all saved models? #559

Closed
VectorZhao opened this issue Aug 13, 2022 · 2 comments
Closed

How could I load a specific model from all saved models? #559

VectorZhao opened this issue Aug 13, 2022 · 2 comments

Comments

@VectorZhao
Copy link

I trained a model using the following code:

automl = AutoML(
    results_path="AutoML_model_CaNaK_unscaled",
    ml_task="multiclass_classification",
    algorithms=["CatBoost", "Xgboost", "LightGBM"],
    model_time_limit=30*60,
    start_random_models=10,
    hill_climbing_steps=3,
    top_models_to_improve=3,
    golden_features=False,
    features_selection=False,
#     stack_models=True,
#     train_ensemble=True,
    explain_level=2,
    validation_strategy={
        "validation_type": "split",
        "train_ratio": 0.75,
        "shuffle": True,
        "stratify": True
    }
)

and now I got lots of models in the "AutoML_model_CaNaK_unscaled" path.
I want to get shap values for a specific model such as 16_LightGBM following the shap git code like the following:

import xgboost
import shap

# train an XGBoost model
X, y = shap.datasets.boston()
model = xgboost.XGBRegressor().fit(X, y)

# explain the model's predictions using SHAP
# (same syntax works for LightGBM, CatBoost, scikit-learn, transformers, Spark, etc.)
explainer = shap.Explainer(model)
shap_values = explainer(X)

I know that using AutoML(results_path="AutoML_model_CaNaK_unscaled") can load the well trained model, but loading a specific model from saved models is what I want.

@pplonski
Copy link
Contributor

Hi @VectorZhao,

It is not yet implemented. There is an issue with adding functionality to load only selected model for computing predictions #423.

You can try to reuse the parameters of the selected model and train only it with some custom script.

@VectorZhao
Copy link
Author

Hi @VectorZhao,

It is not yet implemented. There is an issue with adding functionality to load only selected model for computing predictions #423.

You can try to reuse the parameters of the selected model and train only it with some custom script.

Ok, many thanks for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants