Original article was published by Sivasai Yadav Mudugandla on Artificial Intelligence on Medium
10 Hyperparameter optimization frameworks.
Tune your Machine Learning models with open-source optimization libraries
Hyper-parameters are the parameters used to control the behavior of the algorithm while building the model. These parameters cannot be learned from the regular training process. They need to be assigned before training the model.
Example: n_neighbors (KNN), kernel (SVC) , max_depth & criterion (Decision Tree Classifier) etc.
Hyperparameter optimization or tuning in machine learning is the process of selecting the best combination of hyper-parameters that deliver the best performance.
Various automatic optimization techniques exist, and each has its own strengths and drawbacks when applied to different types of problems.
Example: Grid Search, Random Search, Bayesian Search, etc.
Scikit-learn is one of the frameworks we could use for Hyperparameter optimization, but there are other frameworks that could even perform better.
Tune is a Python library for experiment execution and hyperparameter tuning at any scale.
- Launch a multi-node distributed hyperparameter sweep in less than ten lines of code.
- Supports any machine learning framework, including PyTorch, XGBoost, MXNet, and Keras.
- Choose among the state of the art algorithms such as Population Based Training (PBT), BayesOptSearch, HyperBand/ASHA.
- Tune’s Search Algorithms are wrappers around open-source optimization libraries such as HyperOpt, SigOpt, Dragonfly, and Facebook Ax.
- Automatically visualize results with TensorBoard.
#Tune for Scikit Learn
Installation: pip install ray[tune] tune-sklearn
Optuna is an automatic hyperparameter optimization software framework, particularly designed for machine learning.
- Easy parallelization
- Quick visualization
- Efficient optimization algorithms
- Lightweight, versatile, and platform-agnostic architecture
- Pythonic search spaces
Installation: pip install optuna
Hyperopt is a Python library for serial and parallel optimization over awkward search spaces, which may include real-valued, discrete, and conditional dimensions.
Hyperopt currently it supports three algorithms :
- Search space (you can create very complex parameter spaces)
- Persisting and restarting (you can save important information and later load and then resume the optimization process)
- Speed and Parallelization (you can distribute your computation over a cluster of machines)
Installation: pip install hyperopt
mlmachine is a Python package that facilitates clean and organized notebook-based machine learning experimentation and accomplishes many key aspects of the experimentation life cycle.
mlmachine performs Hyperparameter Tuning with Bayesian Optimization on multiple estimators in one shot and includes functionality for visualizing model performance and parameter selections.
A well explained article on mlmachine.
Installation: pip install mlmachine
Polyaxon is a platform for building, training, and monitoring large scale deep learning applications. It makes a system to solve reproducibility, automation, and scalability for machine learning applications.
The way Polyaxon performs hyperparameter tuning is by providing a selection of customizable search algorithms. Polyaxon supports both simple approaches such as
random search and
grid search, and provides a simple interface for advanced approaches, such as
Bayesian Optimization, it also integrates with tools such as
Hyperopt, and provides an interface for running custom iterative processes. All these search algorithms run in an asynchronous way, and support concurrency and routing to leverage your cluster(s)’s resources to the maximum.
- Easy-to-use: Polyaxon’s Optimization Engine is a built-in service and can be used easily by adding a
matrixsection to your operations, you can run hyperparameter tuning using the CLI, client, and the dashboard.
- Scalability: Tuning hyperparameters or neural architectures requires leveraging a large amount of computation resources, using Polyaxon you can run hundreds of trials in parallel and intuitively track their progress.
- Flexibility: Besides the rich built-in algorithms, Polyaxon allows users to customize various hyperparameter tuning algorithms, neural architecture search algorithms, early stopping algorithms, etc.
- Efficiency: We are intensively working on more efficient model tuning from both system-level and algorithm level. For example, leveraging early feedback to speedup tuning procedure.
Installation: pip install -U polyaxon
6. Bayesian Optimization
Bayesian Optimization is another framework that is a pure Python implementation of Bayesian global optimization with Gaussian processes. This is a constrained global optimization package built upon Bayesian inference and Gaussian process, that attempts to find the maximum value of an unknown function in as few iterations as possible. This technique is particularly suited for the optimization of high-cost functions, situations where the balance between exploration and exploitation is important.
pip install bayesian-optimization
Talos radically changes the ordinary Keras workflow by fully automating hyperparameter tuning and model evaluation. Talos exposes Keras functionality entirely and there is no new syntax or templates to learn.
- Single-line optimize-to-predict pipeline
talos.Scan(x, y, model, params).predict(x_test, y_test)
- Automated hyperparameter optimization
- Model generalization evaluator
- Experiment analytics
- Pseudo, Quasi, and Quantum Random search options
- Grid search
- Probabilistic optimizers
- Single file custom optimization strategies
pip install talos
SHERPA is a Python library for hyperparameter tuning of machine learning models.
- hyperparameter optimization for machine learning researchers
- a choice of hyperparameter optimization algorithms
- parallel computation that can be fitted to the user’s needs
- a live dashboard for the exploratory analysis of results.
Installation: pip install parameter-sherpa
skopt, is a simple and efficient library to minimize (very) expensive and noisy black-box functions. It implements several methods for sequential model-based optimization.
skopt aims to be accessible and easy to use in many contexts. Scikit-Optimize provides support for tuning the hyperparameters of ML algorithms offered by the scikit-learn library, so-called hyperparameter optimization.
The library is built on top of NumPy, SciPy and Scikit-Learn.
Installation: pip install scikit-optimize
GPyOpt is a tool for optimization (minimization) of black-box functions using Gaussian processes. It has been implemented in Python by the group of Machine Learning (at SITraN) of the University of Sheffield.GPyOpt is based on GPy, a library for Gaussian process modeling in Python. It can handle large data sets via sparse Gaussian process models.
- Bayesian optimization with arbitrary restrictions
- Parallel Bayesian optimization
- Mixing different types of variables
- Tuning scikit-learn models
- Integrating the model hyper parameters
- External objective evaluation
Installation: pip install gpyopt
Thank you for reading!
Any feedback and comments are, greatly appreciated!
Some of my other posts you may find interesting,