Skip to main content

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/values
  • y_pred: Model predictions
  • verbose: 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 features
  • y_train: Training labels
  • X_test: Test features
  • y_test: Test labels
  • verbose: 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

  1. Quick Model Validation: Evaluate models in notebooks instantly
  2. Model Comparison: Compare different models side-by-side
  3. Debugging: Identify why models underperform
  4. Production Monitoring: Monitor model performance over time
  5. Data Quality: Verify data preprocessing pipeline
  6. 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


Smart Eval - Making ML evaluation intelligent and effortless โšก

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

mlevalu-2.0.0.tar.gz (40.0 kB view details)

Uploaded Source

Built Distribution

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

mlevalu-2.0.0-py3-none-any.whl (42.3 kB view details)

Uploaded Python 3

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

Hashes for mlevalu-2.0.0.tar.gz
Algorithm Hash digest
SHA256 6b62cf87c8b6e92f9eb359c49b77581da2da462a4da04b4a963210c4ece5e512
MD5 29420aab1d8423e670e46607ba8a1fb7
BLAKE2b-256 1b15deff151beba92dee2ec454a75348c2d80829fb04b45a6b61d6b931cc91af

See more details on using hashes here.

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

Hashes for mlevalu-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f2cea19632ee8b9a94c25501b51602d35ff563ef3041402fcc6659742378ae0
MD5 4d5656030b59a95a85118b3d1d5f003b
BLAKE2b-256 5a34bf1fcec84baa4f42b02840ecfb7d9bf38e4a45284c921106c0bb2eb5c392

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