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 details)

Uploaded Source

Built Distribution

SkOpts-0.0.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file SkOpts-0.0.1.tar.gz.

File metadata

  • Download URL: SkOpts-0.0.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for SkOpts-0.0.1.tar.gz
Algorithm Hash digest
SHA256 715a7734230482613c6ce5fd7ed653f711817904e23ea82eb92165f0f688515d
MD5 46c3387f8f285b572bf7040484b72010
BLAKE2b-256 e3d3b6fe60cfb0eb2f5dad38747c77fed13ed1699221c6643da52c5dfb480250

See more details on using hashes here.

File details

Details for the file SkOpts-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: SkOpts-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for SkOpts-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9eac166d7c573a450216cf97a077939be9a0c3352066186f0878cd5bb286e6b
MD5 df931c03ff44911518945601bf9fca61
BLAKE2b-256 d2db3eb121c76fbe0308bacf642bf9dd5f414eb65e1e2db329a1fe1060ecaa62

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