chevron_left
Cookbooks
0
0
0
new
Getting hyper-parameters of models in Scikit-learn
Programming
chevron_rightPython
chevron_rightScikit-learn
chevron_rightCookbooks
schedule Mar 21, 2022
Last updated Python
Tags tocTable of Contents
expand_more Solution
To get all the hyper-parameters of a model in Scikit-learn:
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier(max_depth=4)model.get_params()
{'bootstrap': True, 'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 4, 'max_features': 'auto', 'max_leaf_nodes': None, 'max_samples': None, 'min_impurity_decrease': 0.0, 'min_impurity_split': None, 'min_samples_leaf': 1, 'min_samples_split': 2, 'min_weight_fraction_leaf': 0.0, 'n_estimators': 100, 'n_jobs': None, 'oob_score': False, 'random_state': None, 'verbose': 0, 'warm_start': False}
Here, we see the default hyper-parameters of a random forest model.
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?
Ask a question or leave a feedback...