I have the following dictionary:
hyper_params = {'penalty': ['l1', 'l2'], 'class_weight': [None, 'balanced'], 'max_iter': [500, 1000]}
I need to train LogisticRegression
of sklearn
on all possible combinations of parameters from hyper_params
, e.g.:
from sklearn.linear_model import LogisticRegression
LogisticRegression(penalty='l1', class_weight=None, max_iter=500)
LogisticRegression(penalty='l2', class_weight=None, max_iter=500)
etc.
How can I create all possible combinations of these 3 parameters, so that I can pass them as **args_comination
to LogisticRegression
.
I cannot use the hyperparameters optimisation library. Therefore I'm searching for a custom approach to enumerate hyper_params
.