Skip to content

Instantly share code, notes, and snippets.

@kvnkho
Created January 19, 2022 03:35
Show Gist options
  • Save kvnkho/8425b521852f74fd1a4b5fd72654f7ab to your computer and use it in GitHub Desktop.
Save kvnkho/8425b521852f74fd1a4b5fd72654f7ab to your computer and use it in GitHub Desktop.
@task
def get_models():
space1 = Space(model=LogisticRegression, solver="lbfgs", C=Grid(10,20), penalty=Grid("l2","none"))
space2 = Space(model=RandomForestClassifier, max_samples=Rand(0.8,1), max_depth=RandInt(3,4)).sample(4)
space = [x.simple_value for x in list(space1+space2)]
models = []
for model_params in space:
model = model_params.pop("model")
models.append(model(**model_params))
return models
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment