Skip to main content

This package is to facilitate model selection in Machine Learning.

Project description

Machine Learning Model Selection

This package aims to facilitate model selection in Machine Learning. It is a common issue that ML practitioners often struggle to decide on the most appropriate model prior to optimization, as tuning hyperparameters can be time-consuming and computationally demanding. To simplify the process, this package enables users to train several machine learning models using their default hyperparameters and compare their performance, helping them determine the most suitable model to select.

Usage

pip install mlms -U

pypi package

Then instantiate and use it like this:

from mlms.ModelSelection import Select_Regressor, Select_Classifier

Select some models to tune, this list should be the abbreviation of models as below, for example

MODELS = ['LGR', 'AB', 'CART', 'GBC', 'XGBC', 'RFC', 'ETC', 'KNN', 'NB', 'SVC', 'MLP', 'SGDC', 'GPC', 'PAC']

df_performance, fitted_classifiers = Select_Classifier('accuracy', 10, X_train, X_test, y_train, y_test, MODELS)

df_performance, fitted_regressors = Select_Classifier('neg_mean_squared_erro', 10, X_train, X_test, y_train, y_test)

For classifiers, the performance can set as accuracy , 'f1_score , precision, recall, roc_auc , balanced_accuracy_score and so on. Available classifiers are below

  • ('LGR', LogisticRegression(n_jobs=-1)),
  • ('AB', AdaBoostClassifier()),
  • ('CART', DecisionTreeClassifier()),
  • ('GBC', GradientBoostingClassifier()),
  • ('XGBC', XGBClassifier()),
  • ('RFC', RandomForestClassifier()),
  • ('ETC', ExtraTreeClassifier()),
  • ('KNN', KNeighborsClassifier(n_jobs=-1)),
  • ('NB', GaussianNB()),
  • ('SVC', SVC()),
  • ('MLP', MLPClassifier()),
  • ('SGDC', SGDClassifier(n_jobs=-1)),
  • ('GPC', GaussianProcessClassifier(n_jobs=-1)),
  • ('PAC', PassiveAggressiveClassifier(n_jobs=-1))

(The charts is an classifier selection example using Iris dataset)

1679444303986

1679443565646

1679443664816

For regressors, the performance can set as r2_score, neg_mean_squared_error and so on. Available regressors are below:

  • ('KNN', KNeighborsRegressor()),
  • ('CART', DecisionTreeRegressor()),
  • ('SVR', SVR()),
  • ('MLP', MLPRegressor()),
  • ('ABR', AdaBoostRegressor()),
  • ('GBR', GradientBoostingRegressor()),
  • ('XGB', XGBRegressor()),
  • ('RFR', RandomForestRegressor()),
  • ('ETR', ExtraTreesRegressor())

1679487197758

Additonally, this package also alow users to plot ROC_Curve

from mlms.plot_roc_curve import Multiclass_ROC_Curve, Binary_ROC_Curve

Multiclass_ROC_Curve(X_test, y_test, fitted_model, chart_title:str)

1679785680784

Binary_ROC_Curve(y_true, y_pred,chart_name:str)

GitHub

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

mlms-0.8.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlms-0.8.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file mlms-0.8.0.tar.gz.

File metadata

  • Download URL: mlms-0.8.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for mlms-0.8.0.tar.gz
Algorithm Hash digest
SHA256 f9e39af90a7db5208965db08d289e9772d2970666b6b54720eb57451d4297165
MD5 f0a003449796ded0eae92681b74fd846
BLAKE2b-256 8381b691a3dccec95177b0c83cbb4be394e68b331a68d7931ca9ac8e8f6a63aa

See more details on using hashes here.

File details

Details for the file mlms-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: mlms-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for mlms-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea0e0aaaae3ebc5035fb3a34d0347c153730f42214e5a9821521d447bd94ce71
MD5 468ee80c6e5c70947bbd7a91418d7b28
BLAKE2b-256 4d339b37f9fae4eda24aaca5253deb2245a39239835034b8e91a7877b6cee2d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page