Skip to main content

mloptimizer is a Python library for optimizing hyperparameters of machine learning algorithms using genetic algorithms.

Project description

Documentation Status PyPI version PyPI pyversions Coverage Status

mloptimizer

mloptimizer is a Python library for optimizing hyperparameters of machine learning algorithms using genetic algorithms. With mloptimizer, you can find the optimal set of hyperparameters for a given machine learning model and dataset, which can significantly improve the performance of the model. The library supports several popular machine learning algorithms, including decision trees, random forests, and gradient boosting classifiers. The genetic algorithm used in mloptimizer provides an efficient and flexible approach to search for the optimal hyperparameters in a large search space.

Installation

It is recommended to create a virtual environment using the venv package. To learn more about how to use venv, check out the official Python documentation at https://docs.python.org/3/library/venv.html.

# Create the virtual environment
python -m venv myenv
# Activate the virtual environment
source myenv/bin/activate

To install mloptimizer, run:

pip install mloptimizer

You can get more information about the package installation at https://pypi.org/project/mloptimizer/.

Quickstart

Here's a simple example of how to optimize hyperparameters in a decision tree classifier using the iris dataset:

from mloptimizer.genoptimizer import TreeOptimizer
from sklearn.datasets import load_iris

X, y = load_iris(return_X_y=True)

#   
opt = TreeOptimizer(X, y, "Optimizer")

clf = opt.optimize_clf(10, 10)

The last line of code will create a directory in the current folder with a name like YYYYMMDD_nnnnnnnnnn_TreeOptimizer. This folder contains the results of the optimization, including the best estimator found and the log file opt.log informing with all the steps, the best estimator and the result of the optimization.

More details in the documentation.

Dependencies

The following dependencies are used in mloptimizer:

  • Deap - Genetic Algorithms
  • XGBoost - Gradient boosting classifier
  • Scikit-Learn - Machine learning algorithms and utilities
  • Keras - Deep learning library

Documentation

The documentation for mloptimizer can be found in the project's wiki with examples and classes and methods reference.

Authors

License

This project is licensed under the MIT License.

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

mloptimizer-0.5.9.22.tar.gz (852.0 kB view hashes)

Uploaded Source

Built Distribution

mloptimizer-0.5.9.22-py3-none-any.whl (21.6 kB view hashes)

Uploaded Python 3

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