Add Grid Search Functionality for Best Hyperparameter Tuning #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
GridSearchModel
class encapsulates the process of hyperparameter tuning using GridSearchCV, providing a modular and flexible interface for model selection and training. It includes methods for fitting a model, predicting, saving/loading models, and additional utility functions.Parameters
Methods
Fits the model using grid search with the specified dataset and target variable.
Makes predictions using the best model found by grid search.
Evaluates the performance of the best model on a test dataset.
Returns the best hyperparameters found by the grid search.
Saves the best model to a file.
Loads a previously saved model from a file.
Plots the feature importances from the best model. Only works for models that have the feature_importances_ attribute, such as RandomForest.
Generates a summary of cross-validation scores for the best model.
Example Usage
You can view the new functions in Colab