An advanced machine learning library for effortless model training, evaluation, and selection.


License
MIT
Install
pip install smartpredict==0.7.8

Documentation

SmartPredict

PyPI version Build Status License: MIT

SmartPredict is an advanced machine learning library designed to simplify model training, evaluation, and selection. It provides a comprehensive set of tools for classification and regression tasks, including automated hyperparameter tuning, feature engineering, ensemble methods, and model explainability.

Table of Contents

Installation

You can install SmartPredict using pip:

pip install smartpredict

Features

  • Advanced Model Selection: Supports a wide range of models, including tree-based methods, neural networks, and more.
  • Automated Hyperparameter Tuning: Uses Optuna for efficient hyperparameter optimization.
  • Feature Engineering: Includes tools for automated feature creation and selection.
  • Ensemble Methods: Implements stacking, blending, and voting techniques.
  • Model Explainability: Provides SHAP and LIME for interpretability.
  • Parallel Processing: Speeds up model training and evaluation.

Quick Start

Here’s a quick example to get you started:

from smartpredict import SmartClassifier
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split

data = load_breast_cancer()
X = data.data
y = data.target

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=123)

clf = SmartClassifier(verbose=1)
results = clf.fit(X_train, X_test, y_train, y_test)
print(results)

Usage

Classification

from smartpredict import SmartClassifier

# Your code for loading and splitting data

clf = SmartClassifier(verbose=1)
results = clf.fit(X_train, X_test, y_train, y_test)
print(results)

Regression

from smartpredict import SmartRegressor

# Your code for loading and splitting data

reg = SmartRegressor(verbose=1)
results = reg.fit(X_train, X_test, y_train, y_test)
print(results)

Advanced Features

Hyperparameter Tuning

SmartPredict uses Optuna for hyperparameter optimization:

clf = SmartClassifier(hyperparameter_tuning=True)
results = clf.fit(X_train, X_test, y_train, y_test)
print(results)

Feature Engineering

Automated feature engineering to improve model performance:

from smartpredict import SmartClassifier

clf = SmartClassifier(feature_engineering=True)
results = clf.fit(X_train, X_test, y_train, y_test)
print(results)

Explainability

Model explainability with SHAP:

clf = SmartClassifier(explainability=True)
results = clf.fit(X_train, X_test, y_train, y_test)
print(results)

Ensemble Methods

Combine multiple models for better performance:

clf = SmartClassifier(ensemble_methods=True)
results = clf.fit(X_train, X_test, y_train, y_test)
print(results)

Model Assessment

SmartPredict provides comprehensive model assessment metrics to evaluate your machine learning models. Here is how you can use it:

from smartpredict import ModelAssessment

# Assuming model, X_test, and y_test are defined
assessment = ModelAssessment(model, X_test, y_test)
results = assessment.summary()

print("Model Assessment Metrics:")
print(f"Accuracy: {results['accuracy']}")
print(f"Precision: {results['precision']}")
print(f"Recall: {results['recall']}")
print(f"F1 Score: {results['f1_score']}")
print(f"Confusion Matrix: {results['confusion_matrix']}")
print(f"ROC AUC: {results['roc_auc']}")
print("Classification Report:")
print(results['classification_report'])

Contributing

We welcome contributions! Please read our Contributing Guidelines for more information.

License

SmartPredict is licensed under the MIT License. See the LICENSE file for details.