CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-interpret

Fit interpretable models and explain blackbox machine learning with comprehensive interpretability tools.

Pending
Overview
Eval results
Files

performance.mddocs/

Performance Evaluation

Comprehensive model performance analysis tools with interactive visualizations for classification and regression tasks.

Capabilities

ROC Analysis

Receiver Operating Characteristic curves for binary and multi-class classification performance evaluation.

class ROC:
    def __init__(self, **kwargs):
        """ROC curve analyzer."""
    
    def explain_perf(self, y_true, y_prob, name=None):
        """
        Generate ROC curve analysis.
        
        Parameters:
            y_true (array-like): True binary labels
            y_prob (array-like): Predicted probabilities
            name (str, optional): Name for explanation
            
        Returns:
            Explanation object with ROC curves and AUC scores
        """

Precision-Recall Analysis

Precision-Recall curves particularly useful for imbalanced datasets.

class PR:
    def __init__(self, **kwargs):
        """Precision-Recall curve analyzer."""
    
    def explain_perf(self, y_true, y_prob, name=None):
        """
        Generate Precision-Recall curve analysis.
        
        Parameters:
            y_true (array-like): True binary labels
            y_prob (array-like): Predicted probabilities
            name (str, optional): Name for explanation
            
        Returns:
            Explanation object with PR curves and average precision scores
        """

Regression Performance

Comprehensive regression metrics including residual analysis and error distributions.

class RegressionPerf:
    def __init__(self, **kwargs):
        """Regression performance analyzer."""
    
    def explain_perf(self, y_true, y_pred, name=None):
        """
        Generate regression performance analysis.
        
        Parameters:
            y_true (array-like): True target values
            y_pred (array-like): Predicted values
            name (str, optional): Name for explanation
            
        Returns:
            Explanation object with regression metrics and residual plots
        """

Usage Examples

from interpret.perf import ROC, PR, RegressionPerf
from interpret import show
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
from sklearn.datasets import make_classification, make_regression
from sklearn.model_selection import train_test_split

# Classification performance
X, y = make_classification(n_samples=1000, n_classes=2, random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

clf = RandomForestClassifier(random_state=42)
clf.fit(X_train, y_train)
y_prob = clf.predict_proba(X_test)[:, 1]

# ROC analysis
roc = ROC()
roc_exp = roc.explain_perf(y_test, y_prob, name="ROC Analysis")
show(roc_exp)

# PR analysis
pr = PR()
pr_exp = pr.explain_perf(y_test, y_prob, name="PR Analysis")
show(pr_exp)

# Regression performance
X_reg, y_reg = make_regression(n_samples=1000, noise=0.1, random_state=42)
X_train_reg, X_test_reg, y_train_reg, y_test_reg = train_test_split(X_reg, y_reg, test_size=0.2, random_state=42)

reg = RandomForestRegressor(random_state=42)
reg.fit(X_train_reg, y_train_reg)
y_pred_reg = reg.predict(X_test_reg)

reg_perf = RegressionPerf()
reg_exp = reg_perf.explain_perf(y_test_reg, y_pred_reg, name="Regression Performance")
show(reg_exp)

Install with Tessl CLI

npx tessl i tessl/pypi-interpret

docs

blackbox.md

data.md

glassbox.md

greybox.md

index.md

performance.md

privacy.md

utils.md

visualization.md

tile.json