Skip to main content

Help you train and optimize many popular classifiers in one place with a summary table

Project description

classifierpromax

drawing

Documentation StatusPython 3.12 ci-cd codecov

https://app.codecov.io/github/UBC-MDS/ClassifierProMax

classifierpromax is a scikit-learn wrapper library that helps to train and optimize multiple classifier models in parallel.

ClassifierTrainer(): Train multiple machine learning classifiers using cross-validation and return trained models and evaluation metrics.

FeatureSelector(): Selects features for multiple classification models using RFE or Pearson methods.

ClassifierOptimizer(): Optimizes a dictionary of scikit-learn Pipeline classifiers using RandomizedSearchCV and evaluates their performance.

ResultsHandler(): Processes and combines scoring results from model training and optimization.

In a machine learning pipeline, code can often be repeated when working with multiple models, violating the DRY (Don’t-Repeat-Yourself) principle. This Python library is to promote DRY principles in machine learning code and create cleaner code.

Installation

$ pip install classifierpromax

Usage

  1. Training baseline models
import pandas as pd
import numpy as np
from classifierpromax.ClassifierTrainer import ClassifierTrainer
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler

# Dummy data
X = pd.DataFrame(np.random.rand(100, 5), columns=[f"feature_{i}" for i in range(5)])
y = pd.Series(np.random.randint(0, 2, size=100))

preprocessor = StandardScaler()
baseline_models, baseline_score = ClassifierTrainer(preprocessor, X, y, seed=123)
  1. Feature selection
from classifierpromax.FeatureSelector import FeatureSelector

fs_models = FeatureSelector(preprocessor, baseline_models, X, y, n_features_to_select=3)
  1. Hyperparameter optimization
from classifierpromax.ClassifierOptimizer import ClassifierOptimizer

opt_models, opt_score = ClassifierOptimizer(fs_models, X, y, scoring="f1")
  1. Results summary
from classifierpromax.ResultHandler import ResultHandler

summary = ResultHandler(baseline_score, opt_score)
print(summary)

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

Contributors

Long Nguyen, Jenson Chang, Gunisha Kaur, Han Wang

License

classifierpromax was created by Long Nguyen, Jenson Chang, Gunisha Kaur, Han Wang. It is licensed under the terms of the MIT license.

Credits

classifierpromax was created with cookiecutter and the py-pkgs-cookiecutter template.

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

classifierpromax-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

classifierpromax-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file classifierpromax-0.1.0.tar.gz.

File metadata

  • Download URL: classifierpromax-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for classifierpromax-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6e8576474e00989904cca4f3ce6b2eb737786b01b8dcb3eb780b2ea056f60655
MD5 04cb72120ed0cad7bd667477282bce4a
BLAKE2b-256 66029cdbbb369c42bb2f92843eb24fe8e3da6d53a054343107fd0ea99fe13813

See more details on using hashes here.

File details

Details for the file classifierpromax-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for classifierpromax-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dccc9ed186dacd56ad212da767f560da33fc5f9985c8791c029533a50acb6205
MD5 c17c0722303347b6120c5feb6ee4d29a
BLAKE2b-256 f163fff0d72baf858000b622fac3e0992b4d9a74ca9476948e2b36229bfea2fe

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