Skip to main content

A lightweight multi-stage grid search AutoML framework for classifiers. GridMaster v0.2.0: Log-scale search + plot customization features

Project description

GridMaster Banner

GridMaster: A Lightweight Multi-Stage Grid Search AutoML Framework for Classifiers

GridMaster is a Python module built for data scientists who want flexible and interpretable model selection and tuning on structured classification datasets. It automates the hyperparameter tuning process using coarse-to-fine grid search and supports model evaluation, visualization, export, and reproducibility.

⚠️ GridMaster is currently designed for classification tasks only, and does not yet support regressors.


📖 Full Documentation


🔍 Supported Models

Model Name Backend Module Notes
Logistic Regression sklearn.linear_model Great interpretability via coefficients
Random Forest sklearn.ensemble Robust baseline, provides feature importance
XGBoost xgboost Highly accurate, supports regularization
LightGBM lightgbm Fast, efficient gradient boosting
CatBoost catboost Handles categorical features natively

DecisionTreeClassifier is intentionally excluded due to its high variance and limited generalization ability. Use ensemble variants instead.


🚀 Installation

pip install scikit-learn xgboost lightgbm catboost pandas numpy matplotlib joblib

Then clone the repository:

git clone https://github.com/wins-wang/GridMaster.git

⚙️ How GridMaster Works

from gridmaster import GridMaster
gm = GridMaster(models=[...], X_train=..., y_train=...)

You can then call:

  • gm.coarse_search(...)
  • gm.fine_search(...)
  • gm.multi_stage_search(...)
  • gm.compare_best_models(...)
  • Visualization + export + import...

All with built-in output redirection for noisy models.


🔁 Recommended Workflow

gm.multi_stage_search("xgboost", scoring="roc_auc")
gm.compare_best_models(X_test, y_test, metrics=["f1", "roc_auc"])
gm.plot_cv_score_curve("xgboost")
gm.export_model_package("xgboost")

Use suppress_output=False if you want to see model logs.


📘 Demo Usage: Breast Cancer Classifier

# demo_usage.ipynb

from gridmaster import GridMaster
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
import pandas as pd
import os
import warnings

warnings.filterwarnings("ignore")

X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

gm = GridMaster(
    models=["logistic", "random_forest", "xgboost", "lightgbm", "catboost"],
    X_train=X_train,
    y_train=y_train
)

for model in ["logistic", "random_forest", "xgboost", "lightgbm", "catboost"]:
    gm.multi_stage_search(model, scoring="f1")

best_model, scores = gm.compare_best_models(X_test, y_test, metrics=["accuracy", "f1", "roc_auc"])
print("Best model:", best_model)
print(scores)

# Visualize all
for model in ["logistic", "random_forest", "xgboost", "lightgbm", "catboost"]:
    gm.plot_cv_score_curve(model)
    gm.plot_confusion_matrix(model, X_test, y_test)
    if model == "logistic":
        gm.plot_model_coefficients(model)
    else:
        gm.plot_feature_importance(model)

# Export and reload
os.makedirs("outputs", exist_ok=True)
gm.export_all_models(folder_path="outputs")
gm.import_all_models(folder_path="outputs")

# Final report
final_model = gm.results[best_model]["best_model"]
X_test_df = pd.DataFrame(X_test, columns=X_train.columns)
y_pred = final_model.predict(X_test_df)
print(classification_report(y_test, y_pred))

📦 Packaging Info


📜 License

MIT License. See 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

gridmaster-0.5.2.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

gridmaster-0.5.2-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file gridmaster-0.5.2.tar.gz.

File metadata

  • Download URL: gridmaster-0.5.2.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.7

File hashes

Hashes for gridmaster-0.5.2.tar.gz
Algorithm Hash digest
SHA256 d281794a41dd7aa34950858322be57ceabc7f79f4b63bc89a3b9d929e9c63bfe
MD5 573080d9a3eda2755f7ff9191c5d48be
BLAKE2b-256 3fcc331e846ac2e971ea65a3e27d7eea71c3b70ea66e81255a95684e2ddd2474

See more details on using hashes here.

File details

Details for the file gridmaster-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: gridmaster-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.7

File hashes

Hashes for gridmaster-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fee8eeb0b3f362e4e40bb0d2898cc94434762c91a33bac32fce161089f3d9b3d
MD5 81b5ba1f6d87c88f6b4155a4e47bb06e
BLAKE2b-256 f02f2a8d6b4a24c8e28e50449aed32f5eb6e5e00057d9e707ed9743075e1d997

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