Skip to main content

A Python Package for Automatic Multi-Model Analysis (Classification & Regression)

Project description

Multi-Model Analysis

PyPI version License: Apache

multimodel_analysis is a comprehensive machine learning library created by Uditya Narayan Tiwari. It automates the process of training, evaluating, and visualizing multiple models for both Classification and Regression tasks.

Designed for data scientists and researchers, it streamlines model selection by providing automatic feature scaling, detailed performance metrics, and professional-grade visualizations in just a few lines of code.


📦 Installation

Install via PyPI

The easiest way to install the package is via pip:

pip install multimodel_analysis

Install from GitHub

To get the latest development version:

pip install git+[https://github.com/udityamerit/multimodel_analysis.git](https://github.com/udityamerit/Multimodel-Analysis-Pacakge.git) --upgrade --force-reinstall

📋 Requirements

  • numpy
  • pandas
  • matplotlib
  • seaborn
  • scikit-learn

How to Use

1. Classification Analysis

Use MultiModelClassifier for categorical target variables. It automatically compares models like Logistic Regression, SVM, Decision Trees, Random Forest, Gradient Boosting, and more.

Step 1: Initialize and Train

import pandas as pd
from multimodel_analysis import MultiModelClassifier

# Load your dataset
df = pd.read_csv('your_classification_data.csv')
X = df.drop('target_column', axis=1)
y = df['target_column']

# Initialize the classifier
# scaled_data=True applies StandardScaler automatically
classifier = MultiModelClassifier(X, y, test_size=0.3, scaled_data=True)

# Train all models and get results
results = classifier.run_all_models()

Step 2: View Metrics & Best Model

Generates a clean dataframe of metrics (Accuracy, Precision, Recall, F1, AUC) and prints the best recommendation.

classifier.show_tabular_report(results)

Step 3: Visualize Confusion Matrices

Plots confusion matrices for every trained model with distinct color palettes.

classifier.plot_confusion_matrices(results)

Step 4: Plot ROC Curves

Overlays ROC curves for all models to compare Area Under the Curve (AUC) performance.

classifier.plot_roc_curves(results)

Step 5: Compare All Metrics

Plots a grouped bar chart comparing Accuracy, Precision, Recall, and F1 Score.

classifier.plot_comparison(results)

2. Regression Analysis

Use MultiModelRegressior for continuous target variables. It compares Linear Regression, Lasso, Ridge, SVR, Random Forest, Gradient Boosting, etc.

Step 1: Initialize and Train

from multimodel_analysis import MultiModelRegressior

# Load your dataset
df = pd.read_csv('your_regression_data.csv')
X = df.drop('price', axis=1)
y = df['price']

# Initialize the regressor
regressor = MultiModelRegressior(X, y, test_size=0.3, scaled_data=True)

# Train all models
results = regressor.run_all_models()

Step 2: View Metrics & Best Model

Generates a table of MAE, MSE, RMSE, and R2 Scores, and recommends the best model based on R2.

regressor.show_tabular_report(results)

Step 3: True vs. Predicted Plots

Visualizes the relationship between actual and predicted values with an ideal fit line.

regressor.plot_true_vs_predicted(results)

Step 4: Compare R2 Scores

Plots a bar chart to easily identify the model with the highest R2 score.

regressor.plot_comparison(results)

Key Features

🔹 Intelligent Automation

  • Automatic Scaling: Simply set scaled_data=True to standardize your features using StandardScaler before training.
  • Best Model Detection: Automatically highlights the best performing model based on Accuracy (Classification) or R2 Score (Regression).

🔹 Professional Visualizations

  • Colorful Confusion Matrices: Automatically cycles through color maps (Blues, Greens, Oranges, etc.) for distinct model visualization.
  • ROC Curve Overlays: clean comparison of True Positive vs False Positive rates.
  • Regression Fit Plots: Scatter plots with diagonal reference lines to visually assess regression performance.

🔹 Extensive Model Library

  • Classifiers: Logistic Regression, SVM, Decision Tree, KNN, Naive Bayes, Random Forest, Gradient Boosting, AdaBoost.
  • Regressors: Linear Regression, Lasso, Ridge, SVR, Decision Tree, Random Forest, Gradient Boosting.

👨‍💻 Author

Uditya Narayan Tiwari

📄 License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

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

multimodel_analysis-0.0.3.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

multimodel_analysis-0.0.3-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file multimodel_analysis-0.0.3.tar.gz.

File metadata

  • Download URL: multimodel_analysis-0.0.3.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for multimodel_analysis-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2ca0169d87ae14ef023bae8faf027964e49bd1e955cf563d1cd941a54e45334d
MD5 ba7535671438ac827de8d7fe39394062
BLAKE2b-256 a4a4b9023811ce8038f74a5608221ff141109db3c8fb363dd983f3936d2e3ac6

See more details on using hashes here.

File details

Details for the file multimodel_analysis-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for multimodel_analysis-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 140cca618e08ceda0bfb59229ab98bf77db294574e6e32416d0ed43a8f900945
MD5 c5d6b91a1675d277036c39fd23e71029
BLAKE2b-256 b8404e4cd1e9dde1ae0bfb2b8228a0249d40a31b2eb2e4ee93f431be537de414

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