Skip to main content

Package for tuning hyperparameters with resampling methods

Project description

Hyperparameter TuneRs

tuneRs is a small package for tuning hyperparameters using resampling methods instead of normal crossvalidation. Estimating model accuracy using resampling methods is much quicker that using k-fold crossvalidation--although resampling tends to underestimate accuracy more that crossvalidation. Resampling underestimates accuracy in a consistent fashion, however, which still makes it valuable for tuning hyperparameters. Due to it's consistency, choosing hyperparameters based on aggregated samples still gets within the neighborhood of maximal while being much, much faster. This is a package to help you get there.

GridSearchResample uses the grid search method to optimize hyperparameters.

RandomSearchResample uses the random search method to optimize hyperparameters.

Current Version is v0.57

This package is currently in the beginning stages and is very bare-bones

Installation

Use the package manager pip to install tuneRs.

pip install tuneRs

Usage

Both classes are meant to mimic the scikit-learn tuners (to a certain degree). A simple example would be:

import tuneRs

model = SVC(kernel='rbf')

parameters = {["gamma": [0.001, 0.01, 0.1, 1.0, 10.0],
		"C": [0.01, 0.1, 1.0, 10.0, 100.0, 1000.0]}

# Set up for a random hyperparameter search
tuner = tuneRs.RandomSearchResample(model, parameters, num_iters=300, sample_size=0.3, num_samples=12)

# Fit the tuner
tuner.fit(X_train, y_train)

# Display the best parameters found
tuner.best_params_

# Display the aggregate resample score of the best parameters <br/>
tuner.best_score_

# Define our new model
model = tuner.best_estimator_

# Plot the resample accuracy distribution for the model with best hyperparameters <br/>
tuner.plot_best()

Future Plans

Multiple tuners are currently planned to be added. The next one will be a Bayesian search method. A dynamic version of grid search and random search is currently being worked on that iterates fit multiple times on increasingly small areas of the data space.

License

Lol

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

tuneRs-0.57.tar.gz (6.2 kB view details)

Uploaded Source

File details

Details for the file tuneRs-0.57.tar.gz.

File metadata

  • Download URL: tuneRs-0.57.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for tuneRs-0.57.tar.gz
Algorithm Hash digest
SHA256 be725a34b94e018637a8b43dd875891e663a2d7a32158dd42d92a172274c4690
MD5 3430f7c908d09a51f296f047675fe156
BLAKE2b-256 896d25c06df8003e8b30ffe5b80dad8983855793ee4076d4fbd25ece3c5e5040

See more details on using hashes here.

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