get_params()
is a method provided by scikit-learn estimators (such as classifiers, regressors, transformers, etc.) that returns a dictionary of the estimator’s parameters. These parameters are the hyperparameters that define the behavior of the estimator and can be tuned during the model selection or hyperparameter optimization process.
Here’s a simple example of how you might use get_params()
:
from sklearn.linear_model import LogisticRegression
# Create a LogisticRegression instance
clf = LogisticRegression()
# Get the parameters of the LogisticRegression estimator
params = clf.get_params()
print(params)
The output will be a dictionary containing the parameters and their values for the LogisticRegression estimator. These parameters typically include things like regularization strength (C
), penalty type (penalty
), solver algorithm (solver
), etc.