Autogluon: Save and Load Individual Models

Created on 29 Jul 2020  路  3Comments  路  Source: awslabs/autogluon

How do I load an individual model?

When i use x.delete_models(models_to_keep='ExtraTreesClassifierEntr_STACKER_l1', dry_run=False)

It keeps many models not just this model?

When I load the pickle file it appears to the same result for every model on the validation data.

Please could someone advise?

Thanks in advance.

question tabular

Most helpful comment

@utopianpallu You can use predictor.info() to get a lot of model-specific information. Alternatively, you can use non-public API's to get access to the models:

your_model_object = predictor._trainer.load_model('your_models_name')

Due note that it isn't recommended that you use the model object outside of the predictor context, as the model depends on a variety of functionality outside of its context to properly generate predictions on new data.

All 3 comments

ExtraTreesClassifierEntr_STACKER_l1 is a Level 1 stack ensemble. That means for it to produce predictions it requires input from Level 0 models. These are the models which are present after the delete models call. It is the minimal valid set of models required for your desired model to function.

@Innixma
Hii I want to load individual models that are generated in models directory and get their metrics.But when i do task.load() , it needs learner.pkl file and that is not present in individual model directory.
How to load model.pkl file from each model that is generated using task.load()?

Please guide, Thanks.

@utopianpallu You can use predictor.info() to get a lot of model-specific information. Alternatively, you can use non-public API's to get access to the models:

your_model_object = predictor._trainer.load_model('your_models_name')

Due note that it isn't recommended that you use the model object outside of the predictor context, as the model depends on a variety of functionality outside of its context to properly generate predictions on new data.

Was this page helpful?
0 / 5 - 0 ratings