model-evaluation-framework
БесплатноБез исполняемых скриптовНе проверенModel evaluation metrics, testing protocols, and performance assessment for Somali dialect classification. Covers accuracy, F1-score, confusion matrix…
Об этом скилле
Model Evaluation Framework
Evaluation Metrics
Primary Metrics
Accuracy:
- Overall correctness across all dialects
- Target: >85% for production
- Formula: (Correct Predictions) / (Total Predictions)
Macro F1-Score:
- Average F1 across all dialect classes
- Treats all dialects equally (good for imbalanced data)
- Target: >0.82
Weighted F1-Score:
- F1 weighted by class support
- Accounts for class imbalance
- Target: >0.85
Per-Class Metrics
Precision (per dialect):
- Of predicted Northern, how many are actually Northern?
- Formula: True Positives / (True Positives + False Positives)
Recall (per dialect):
- Of actual Northern texts, how many did we find?
- Formula: True Positives / (True Positives + False Negatives)
F1-Score (per dialect):
- Harmonic mean of precision and recall
- Formula: 2 × (Precision × Recall) / (Precision + Recall)
Evaluation Protocol
Standard Evaluation
from sklearn.metrics import (
accuracy_score,
precision_recall_fscore_support,
classification_report,
confusion_matrix
)
def evaluate_model(y_true, y_pred, dialect_names):
"""Comprehensive model evaluation"""
# Overall metrics
accuracy = accuracy_score(y_true, y_pred)
# Per-class metrics
precision, recall, f1, support = precision_recall_fscore_support(
y_true, y_pred, average=None, labels=range(len(dialect_names))
)
# Macro averages
macro_f1 = f1.mean()
# Detailed report
report = classification_report(
y_true, y_pred,
target_names=dialect_names,
digits=4
)
# Confusion matrix
cm = confusion_matrix(y_true, y_pred)
return {
'accuracy': accuracy,
'macro_f1': macro_f1,
'per_class': {
dialect_names[i]: {
'precision': precision[i],
'recall': recall[i],
'f1': f1[i],
'support': support[i]
}
for i in range(len(dialect_names))
},
'report': report,
'confusion_matrix': cm
}
Confusion Matrix Analysis
Interpreting Results
Example Confusion Matrix:
Predicted
N S C
Actual N [[450 20 10]
S [ 30 380 15]
C [ 15 25 255]]
Analysis:
- Northern most accurately classified (93.8%)
- Southern confused with Northern in 7% of cases
- Central most challenging (86.4% accuracy)
- Northern rarely confused with Central (2%)
Visualization
import matplotlib.pyplot as plt
import seaborn as sns
def plot_confusion_matrix(cm, dialect_names):
"""Visualize confusion matrix"""
plt.figure(figsize=(8, 6))
sns.heatmap(
cm,
annot=True,
fmt='d',
cmap='Blues',
xticklabels=dialect_names,
yticklabels=dialect_names
)
plt.ylabel('Actual')
plt.xlabel('Predicted')
plt.title('Dialect Classification Confusion Matrix')
plt.tight_layout()
plt.savefig('confusion_matrix.png', dpi=300)
Cross-Validation
K-Fold Strategy
from sklearn.model_selection import StratifiedKFold
import numpy as np
def cross_validate_model(model, X, y, n_folds=5):
"""Stratified k-fold cross-validation"""
skf = StratifiedKFold(n_splits=n_folds, shuffle=True, random_state=42)
fold_scores = []
for fold, (train_idx, val_idx) in enumerate(skf.split(X, y)):
X_train, X_val = X[train_idx], X[val_idx]
y_train, y_val = y[train_idx], y[val_idx]
# Train model
model.fit(X_train, y_train)
# Evaluate
y_pred = model.predict(X_val)
accuracy = accuracy_score(y_val, y_pred)
f1 = f1_score(y_val, y_pred, average='macro')
fold_scores.append({'accuracy': accuracy, 'f1': f1})
print(f"Fold {fold + 1}: Accuracy={accuracy:.4f}, F1={f1:.4f}")
# Report mean and std
acc_mean = np.mean([s['accuracy'] for s in fold_scores])
acc_std = np.std([s['accuracy'] for s in fold_scores])
f1_mean = np.mean([s['f1'] for s in fold_scores])
f1_std = np.std([s['f1'] for s in fold_scores])
print(f"\nCross-Validation Results:")
print(f"Accuracy: {acc_mean:.4f} ± {acc_std:.4f}")
print(f"Macro F1: {f1_mean:.4f} ± {f1_std:.4f}")
return fold_scores
Performance Thresholds
Minimum Acceptable Performance
For Production Deployment:
- Overall Accuracy: ≥85%
- Macro F1-Score: ≥0.82
- Per-Class F1: ≥0.75 for all dialects
- No class with recall <70%
For Research/Experimental:
- Overall Accuracy: ≥75%
- Macro F1-Score: ≥0.70
- Document performance gaps
Error Analysis
Qualitative Review
def analyze_errors(X, y_true, y_pred, dialect_names, n_examples=10):
"""Identify and display misclassified examples"""
errors = []
for i in range(len(y_true)):
if y_true[i] != y_pred[i]:
errors.append({
'text': X[i],
Установить model-evaluation-framework в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepFAQ
Что делает скилл model-evaluation-framework?
Model evaluation metrics, testing protocols, and performance assessment for Somali dialect classification. Covers accuracy, F1-score, confusion matrix analysis, per-dialect performance, and evaluation best practices for multi-class classification tasks.
Как установить скилл model-evaluation-framework?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл model-evaluation-framework запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic