get_params()
noun
say it: “GET puh-RAMZ” /ˈɡɛt pəˈræmz/
In scikit-learn, the method that returns a model's settings as a dictionary of names and values.
What does get_params() do in scikit-learn?
get_params() hands back a model's settings, its hyperparameters, as a dictionary of names and values. On a
pipeline, each step's settings appear with the step's name in front, such as tree__max_depth: the names a grid
search uses.
from sklearn.tree import DecisionTreeClassifier
tree = DecisionTreeClassifier(max_depth=3)
print(tree.get_params()["max_depth"]) # 3
In a sentence
- “She used get_params() to find the exact name grid search needed for the pipeline's tree depth.”
- “get_params() showed the tree's max_depth was still None.”
Level: Freelancer · More Python terms at this level
Updated