# set_params()

*noun*

say it: **“SET puh-RAMZ”** **/ˈsɛt pəˈræmz/**

In scikit-learn, the method that changes a model's settings by name.

## What does **set_params()** do in scikit-learn?

**set_params()** changes a model's settings by name, such as `tree.set_params(max_depth=5)`, and hands back the model.
On a pipeline, `step__setting` names reach inside a step, such as `tree__max_depth`. The new settings take effect at
the next `fit()`.

```python
from sklearn.tree import DecisionTreeClassifier
tree = DecisionTreeClassifier(max_depth=3)
tree.set_params(max_depth=5)
print(tree.max_depth)   # 5
```

## In a sentence

- “She called **set_params()** with knn\_\_n_neighbors=7 to reach inside the pipeline.”
- “**set_params()** changed the tree's depth to 5 before the next fit().”

Level: Freelancer · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=4)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/set-params
