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

Saved model.pkl file is not trained #3

Open
svkadhikary opened this issue Mar 18, 2023 · 1 comment
Open

Saved model.pkl file is not trained #3

svkadhikary opened this issue Mar 18, 2023 · 1 comment

Comments

@svkadhikary
Copy link

Sir, I want to point out one significant point about the saved model.pkl file.
In the utils.py file, we never returned the best model object itself, just the score.

return report

And then in model_trainer.py we sort the best max score and then initialize a totally new model based on the name of the highest score model. And in the save_object we are actually saving the newly initialized model which is untrained.
best_model = models[best_model_name]

What's strange is how it gave a prediction.
Mine didn't and I had to edit the code.
https://github.com/svkadhikary/student_perfomance/blob/45ba9818eb3ab7fb681da7c70d425ed0c70fc0a0/src/utils.py#L66
https://github.com/svkadhikary/student_perfomance/blob/45ba9818eb3ab7fb681da7c70d425ed0c70fc0a0/src/components/model_trainer.py#L100

@Swam80
Copy link

Swam80 commented Mar 30, 2023

Hey,

The model is trained with the best parameters in utils.py itself. See where model.set_params(**gs.best_params_) is done. It sets the parameters to all the model objects one by one and then we do fit, which means it has trained.
I hope you got your point cleared since its been two weeks now.

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