Skip to main content

Defines search spaces for scikit-lean estimators

Project description


.github/workflows/ci.yml codecov

Scikit-learn Search Space Configurations with curated search spaces for scikit-learn estimators.


from sksearchspace import SearchSpace
from sklearn.tree import DecisionTreeClassifier

estimator_space = SearchSpace.for_sklearn_estimator(DecisionTreeClassifier, seed=42)
# {'criterion': 'entropy','min_samples_leaf': 15, 'min_samples_split': 11}

# {'criterion': 'entropy', 'min_samples_leaf': 12, 'min_samples_split': 4}

sksearchspace uses ConfigSpace for sampling. The ConfigSpace configuration can be accessed through an attribute:

# Configuration space object:
# Hyperparameters:
#   criterion, Type: Categorical, Choices: {gini, entropy}, Default: gini
#   min_samples_leaf, Type: UniformInteger, Range: [1, 20], Default: 1
#   min_samples_split, Type: UniformInteger, Range: [2, 20], Default: 2

A json file can be loaded as follows:

with open("search_space.json", "r") as f:
    estimator_space = SearchSpace(


Copyright (c) 2020 Thomas J. Fan

Distributed under the terms of the MIT license, pytest is free and open source software.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sksearchspace-2020. (6.8 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page