Skip to main content

Defines search spaces for scikit-lean estimators

Project description

sksearchspace

.github/workflows/ci.yml codecov

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

Usage

from sksearchspace import SearchSpace
from sklearn.tree import DecisionTreeClassifier

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

estimator_space.sample()
# {'criterion': 'entropy', 'min_samples_leaf': 12, 'min_samples_split': 4}

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

estimator_space.configuration
# 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(f.read())

License

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.8.0.0.23.1.tar.gz (6.8 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page