Skip to main content

Hyperparameters tuning of machine learning models provided by sklearn library using optuna

Project description

SkOpts

Library providing high-level functions for easy hyperparameters tuning of models using Optuna.

This repository contains the project of a library that offers ready-to-use functions to optimize the hyperparameters of some of models provided by the Sklearn API, XGBoost, LightGBM and CatBoost.

Code snippet to optimize a classification model:

from Tune_Xgboost import XGB_tuner

XGB_tuned=XGB_tuner(X=Xtrain,y=y_train,
                    scoring_metric='roc_auc',
                    n_trials=100,
                    N_folds=5,
                    direction='maximize',
                    stratify=True,
                    problem_type='classification')

Code snippet to optimize regression model:

from Tune_Xgboost import XGB_tuner

XGB_tuned=XGB_tuner(X=Xtrain,y=y_train,
                    scoring_metric='neg_mean_squared_error',
                    n_trials=100,
                    N_folds=5,
                    direction='minimize',
                    problem_type='regression')
Parameter Usage
"X" Training dataset without target variable.
"y" Target variable.
"scoring_metric" Metric to optimize.
"n_trials" Number of trials to execute optimization.
"N_folds" Number of folds for cross validation.
"direction" Equals "maximize" or "minimize".
"problem_type" Equals "classification" or "regression".
"stratify" Stratify cv splits based on target distribuition [True or False]

The 'scoring_metric' parameter takes the same values from sklearn API (link of available list: https://scikit-learn.org/stable/modules/model_evaluation.html)

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

SkOpts-0.0.1.tar.gz (9.7 kB view hashes)

Uploaded Source

Built Distribution

SkOpts-0.0.1-py3-none-any.whl (20.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