Zero-code ML Evaluation, Debugging, and Explanation Toolkit
Project description
Smart Eval
Zero-code ML Evaluation, Debugging, and Explanation Toolkit
A production-ready Python library that makes ML model evaluation, debugging, and interpretation effortless.
Think beyond metrics โ auto-evaluation + intelligence + actionable insights.
๐ฏ Features
โจ Automatic Task Detection
Detects whether your problem is classification or regression automatically.
๐ Comprehensive Metrics
- Classification: Accuracy, Precision, Recall, F1-Score, Confusion Matrix, Class Imbalance Detection
- Regression: MAE, MSE, RMSE, Rยฒ Score, MAPE
๐ง Intelligent Insights Engine
Generates human-readable insights that go beyond raw numbers:
- Detects overfitting / underfitting
- Identifies class imbalance issues
- Highlights false positive / false negative patterns
- Suggests actionable improvements
๐ง Model Debugging Engine
Comprehensive debugging to catch common issues:
- Missing value detection
- Feature scaling issues
- Overfitting detection (train vs test gap)
- Data quality assessment
- Feature analysis and statistics
๐จ Beautiful Terminal Output
Colored, formatted output with:
- Professional report layout
- Confusion matrices
- Color-coded warnings and suggestions
- Clear visual hierarchy
๐ป CLI Support
Evaluate models directly from the command line:
smart-eval data.csv --true-col y_true --pred-col y_pred
๐ Quick Start
Installation
pip install smart-eval
Or from source:
git clone https://github.com/your-org/smart_eval
cd smart_eval
pip install -e .
Basic Usage
import smart_eval
# Classification example
y_true = [0, 1, 1, 0, 1, 1, 0, 0, 1, 0]
y_pred = [0, 1, 0, 0, 1, 1, 0, 0, 1, 0]
# One line evaluation with full insights
results = smart_eval.evaluate(y_true, y_pred)
Output Example
======================================================================
SMART EVALUATION REPORT
======================================================================
Task Information
โโโโโโโโโโโโโโ
Task Type........... classification
Number of Classes... 2
Is Binary........... True
Performance Metrics
โโโโโโโโโโโโโโ
Accuracy.............. 0.8000
Precision............. 0.8000
Recall................ 0.8000
F1 score.............. 0.8000
Summary
โโโโโโโโโโโโโโ
Good model performance with room for improvement
Metrics Interpretation
โโโโโโโโโโโโโโ
f1_score: Good balance between precision and recall
Regression Example
import smart_eval
import numpy as np
# Regression example
y_true = np.array([3.0, -0.5, 2.0, 7.0])
y_pred = np.array([2.5, 0.0, 2.0, 8.0])
results = smart_eval.evaluate(y_true, y_pred)
# Outputs: MAE, RMSE, Rยฒ, MAPE and intelligent insights
Model Debugging
import smart_eval
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
# Train model
X = np.random.randn(200, 10)
y = np.random.randint(0, 2, 200)
X_train, X_test, y_train, y_test = train_test_split(X, y)
model = RandomForestClassifier()
model.fit(X_train, y_train)
# Debug the model
debug_report = smart_eval.debug(model, X_train, y_train, X_test, y_test)
# Detects overfitting, scaling issues, missing values, etc.
Getting Only Metrics (No Output)
# Quick evaluation - returns metrics only
metrics = smart_eval.quick_eval(y_true, y_pred)
print(metrics["accuracy"]) # 0.8
๐ API Reference
Main Functions
evaluate(y_true, y_pred, verbose=True)
Main evaluation function with automatic task detection.
Parameters:
y_true: Ground truth labels/valuesy_pred: Model predictionsverbose: Print colored output (default: True)
Returns: Dictionary with task_info, metrics, and insights
debug(model=None, X_train=None, y_train=None, X_test=None, y_test=None, verbose=True)
Debug model for common issues.
Parameters:
model: Trained model (optional)X_train: Training featuresy_train: Training labelsX_test: Test featuresy_test: Test labelsverbose: Print output (default: True)
Returns: Debug report with warnings and recommendations
quick_eval(y_true, y_pred)
Quick evaluation returning only metrics without output.
Returns: Dictionary of metrics
Core Classes (Advanced Usage)
from smart_eval.core.detector import TaskDetector
from smart_eval.core.metrics import MetricsCalculator
from smart_eval.core.insights import InsightGenerator
from smart_eval.debugger import ModelDebugger
# Task detection
detector = TaskDetector()
task_info = detector.detect(y_true, y_pred)
# Calculate metrics
calculator = MetricsCalculator()
metrics = calculator.calculate_classification_metrics(y_true, y_pred)
# Generate insights
generator = InsightGenerator()
insights = generator.generate_classification_insights(y_true, y_pred, metrics, num_classes=2, is_binary=True)
# Debug model
debugger = ModelDebugger()
report = debugger.debug(model, X_train, y_train, X_test, y_test)
๐ฏ Classification Features
Automatic Detection
- Binary classification
- Multi-class classification
- Class imbalance warnings
Metrics
- Accuracy: Overall correctness
- Precision: False positive rate
- Recall: False negative rate
- F1-Score: Balance between precision and recall
- Confusion Matrix: Per-class performance
Insights Generated
- โ Overfitting detection
- โ Class imbalance warnings with severity levels
- โ Precision vs Recall analysis
- โ Model constant prediction detection
- โ Per-class performance hints
- โ Dataset size adequacy analysis
๐ Regression Features
Metrics
- MAE: Mean Absolute Error
- MSE: Mean Squared Error
- RMSE: Root Mean Squared Error
- Rยฒ Score: Coefficient of determination
- MAPE: Mean Absolute Percentage Error
Insights Generated
- โ Rยฒ score interpretation with severity
- โ Negative Rยฒ detection (model worse than baseline)
- โ Outlier prediction detection
- โ Systematic bias detection
- โ Constant prediction detection
- โ Over/underfitting heuristics
๐ Debugging Features
- โ Missing value detection
- โ Feature scaling analysis
- โ Overfitting/underfitting detection
- โ Feature statistics (mean, std, min, max)
- โ Constant feature detection
- โ High variance feature detection
- โ Train/test performance gap analysis
๐ก Use Cases
- Quick Model Validation: Evaluate models in notebooks instantly
- Model Comparison: Compare different models side-by-side
- Debugging: Identify why models underperform
- Production Monitoring: Monitor model performance over time
- Data Quality: Verify data preprocessing pipeline
- Teaching: Teach ML concepts with immediate visual feedback
๐ ๏ธ CLI Usage
Basic Evaluation
smart-eval predictions.csv --true-col target --pred-col prediction
Save Results to JSON
smart-eval predictions.csv -o results.json
Quiet Mode (no colors)
smart-eval predictions.csv --quiet
Custom Column Names
smart-eval data.csv --true-col ground_truth --pred-col model_output
๐ CSV Format Example
Your CSV file should have columns for true labels and predictions:
y_true,y_pred
0,0
1,1
1,0
0,0
1,1
๐ Integration Examples
With scikit-learn
import smart_eval
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y)
model = RandomForestClassifier()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
smart_eval.evaluate(y_test, y_pred)
With XGBoost
import smart_eval
import xgboost as xgb
model = xgb.XGBClassifier()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
smart_eval.evaluate(y_test, y_pred)
With TensorFlow/Keras
import smart_eval
from tensorflow import keras
model = keras.Sequential([...])
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
smart_eval.evaluate(y_test, y_pred)
With PyTorch
import smart_eval
import torch
# ... train model ...
y_pred = model(X_test).argmax(dim=1).numpy()
smart_eval.evaluate(y_test.numpy(), y_pred)
๐จ Customization
Disable Colors
from smart_eval.visualizer import ColorCodes
ColorCodes.disable()
smart_eval.evaluate(y_true, y_pred)
Access Raw Data
results = smart_eval.evaluate(y_true, y_pred, verbose=False)
# Access individual components
metrics = results["metrics"]
insights = results["insights"]
task_info = results["task_info"]
๐ Troubleshooting
ImportError: No module named 'smart_eval'
pip install smart-eval
# or from source:
pip install -e .
"Column not found" in CLI
Check that your column names match your CSV:
smart-eval data.csv --true-col correct_name --pred-col prediction_name
No insights generated
Ensure you have sufficient data (minimum 10 samples recommended)
๐ Requirements
- Python >= 3.7
- numpy >= 1.19.0
- scikit-learn >= 0.24.0
- pandas >= 1.1.0
๐ License
MIT License - see LICENSE file for details
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md
๐ Acknowledgments
Built with โค๏ธ for the ML community
๐ Support
- ๐ง Email: contact@smarteval.dev
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
Smart Eval - Making ML evaluation intelligent and effortless โก
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlevalu-2.0.0.tar.gz.
File metadata
- Download URL: mlevalu-2.0.0.tar.gz
- Upload date:
- Size: 40.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b62cf87c8b6e92f9eb359c49b77581da2da462a4da04b4a963210c4ece5e512
|
|
| MD5 |
29420aab1d8423e670e46607ba8a1fb7
|
|
| BLAKE2b-256 |
1b15deff151beba92dee2ec454a75348c2d80829fb04b45a6b61d6b931cc91af
|
File details
Details for the file mlevalu-2.0.0-py3-none-any.whl.
File metadata
- Download URL: mlevalu-2.0.0-py3-none-any.whl
- Upload date:
- Size: 42.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f2cea19632ee8b9a94c25501b51602d35ff563ef3041402fcc6659742378ae0
|
|
| MD5 |
4d5656030b59a95a85118b3d1d5f003b
|
|
| BLAKE2b-256 |
5a34bf1fcec84baa4f42b02840ecfb7d9bf38e4a45284c921106c0bb2eb5c392
|