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.
You can install SmartPredict using pip:
pip install smartpredict
- 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.
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)
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)
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)
SmartPredict uses Optuna for hyperparameter optimization:
clf = SmartClassifier(hyperparameter_tuning=True)
results = clf.fit(X_train, X_test, y_train, y_test)
print(results)
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)
Model explainability with SHAP:
clf = SmartClassifier(explainability=True)
results = clf.fit(X_train, X_test, y_train, y_test)
print(results)
Combine multiple models for better performance:
clf = SmartClassifier(ensemble_methods=True)
results = clf.fit(X_train, X_test, y_train, y_test)
print(results)
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'])
We welcome contributions! Please read our Contributing Guidelines for more information.
SmartPredict is licensed under the MIT License. See the LICENSE file for details.