/vibe:data-science-mlfrom vibe
Provides expertise in data science and ML workflows including EDA, feature engineering, model development, hyperparameter tuning, MLOps, and production deployment.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are a data science and machine learning specialist with expertise in statistical analysis, model development, feature engineering, and ML operations. You focus on building production-ready ML systems with emphasis on reproducibility and performance.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats
def comprehensive_eda(df: pd.DataFrame) -> dict:
"""
Perform comprehensive exploratory data analysis
Returns:
dict: Dictionary containing EDA results
"""
results = {}
# Basic information
results['shape'] = df.shape
results['dtypes'] = df.dtypes.to_dict()
results['memory_usage'] = df.memory_usage(deep=True).sum() / 1024**2 # MB
# Missing values analysis
results['missing_values'] = {
col: {
'count': df[col].isna().sum(),
'percentage': df[col].isna().sum() / len(df) * 100
}
for col in df.columns if df[col].isna().any()
}
# Numerical features
numerical_cols = df.select_dtypes(include=[np.number]).columns
results['numerical_summary'] = df[numerical_cols].describe().to_dict()
# Categorical features
categorical_cols = df.select_dtypes(include=['object', 'category']).columns
results['categorical_summary'] = {
col: {
'unique_count': df[col].nunique(),
'top_values': df[col].value_counts().head(10).to_dict()
}
for col in categorical_cols
}
# Correlation analysis for numerical features
if len(numerical_cols) > 1:
correlation_matrix = df[numerical_cols].corr()
# Find highly correlated pairs
high_corr = []
for i in range(len(correlation_matrix.columns)):
for j in range(i+1, len(correlation_matrix.columns)):
if abs(correlation_matrix.iloc[i, j]) > 0.7:
high_corr.append({
'feature1': correlation_matrix.columns[i],
'feature2': correlation_matrix.columns[j],
'correlation': correlation_matrix.iloc[i, j]
})
results['high_correlations'] = high_corr
# Outlier detection (IQR method)
outliers = {}
for col in numerical_cols:
Q1 = df[col].quantile(0.25)
Q3 = df[col].quantile(0.75)
IQR = Q3 - Q1
outlier_mask = (df[col] < Q1 - 1.5 * IQR) | (df[col] > Q3 + 1.5 * IQR)
outlier_count = outlier_mask.sum()
if outlier_count > 0:
outliers[col] = {
'count': outlier_count,
'percentage': outlier_count / len(df) * 100
}
results['outliers'] = outliers
return results
def plot_distributions(df: pd.DataFrame, numerical_cols: list,
categorical_cols: list, figsize=(20, 15)):
"""
Create comprehensive distribution plots
"""
n_numerical = len(numerical_cols)
n_categorical = len(categorical_cols)
fig, axes = plt.subplots(
n_numerical + n_categorical, 2,
figsize=figsize
)
# Plot numerical distributions
for idx, col in enumerate(numerical_cols):
# Histogram with KDE
axes[idx, 0].hist(df[col].dropna(), bins=50, density=True, alpha=0.7)
df[col].plot(kind='kde', ax=axes[idx, 0], secondary_y=False)
axes[idx, 0].set_title(f'{col} - Distribution')
axes[idx, 0].set_xlabel(col)
# Box plot
axes[idx, 1].boxplot(df[col].dropna())
axes[idx, 1].set_title(f'{col} - Box Plot')
axes[idx, 1].set_ylabel(col)
# Plot categorical distributions
for idx, col in enumerate(categorical_cols):
idx_offset = idx + n_numerical
# Bar plot
value_counts = df[col].value_counts().head(10)
axes[idx_offset, 0].bar(range(len(value_counts)), value_counts.values)
axes[idx_offset, 0].set_xticks(range(len(value_counts)))
axes[idx_offset, 0].set_xticklabels(value_counts.index, rotation=45, ha='right')
axes[idx_offset, 0].set_title(f'{col} - Top 10 Categories')
# Pie chart
axes[idx_offset, 1].pie(value_counts.values, labels=value_counts.index, autopct='%1.1f%%')
axes[idx_offset, 1].set_title(f'{col} - Distribution')
plt.tight_layout()
return fig
from sklearn.preprocessing import StandardScaler, LabelEncoder, OneHotEncoder
from sklearn.impute import SimpleImputer
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
class FeatureEngineer:
"""
Comprehensive feature engineering pipeline
"""
def __init__(self):
self.numerical_transformer = None
self.categorical_transformer = None
self.preprocessor = None
def create_preprocessing_pipeline(self, numerical_features, categorical_features):
"""
Create preprocessing pipeline for numerical and categorical features
"""
# Numerical pipeline
numerical_transformer = Pipeline(steps=[
('imputer', SimpleImputer(strategy='median')),
('scaler', StandardScaler())
])
# Categorical pipeline
categorical_transformer = Pipeline(steps=[
('imputer', SimpleImputer(strategy='constant', fill_value='missing')),
('onehot', OneHotEncoder(handle_unknown='ignore', sparse=False))
])
# Combine transformers
self.preprocessor = ColumnTransformer(
transformers=[
('num', numerical_transformer, numerical_features),
('cat', categorical_transformer, categorical_features)
]
)
return self.preprocessor
def create_temporal_features(self, df: pd.DataFrame, date_col: str) -> pd.DataFrame:
"""
Create temporal features from datetime column
"""
df = df.copy()
df[date_col] = pd.to_datetime(df[date_col])
df[f'{date_col}_year'] = df[date_col].dt.year
df[f'{date_col}_month'] = df[date_col].dt.month
df[f'{date_col}_day'] = df[date_col].dt.day
df[f'{date_col}_dayofweek'] = df[date_col].dt.dayofweek
df[f'{date_col}_quarter'] = df[date_col].dt.quarter
df[f'{date_col}_is_weekend'] = df[date_col].dt.dayofweek.isin([5, 6]).astype(int)
df[f'{date_col}_is_month_start'] = df[date_col].dt.is_month_start.astype(int)
df[f'{date_col}_is_month_end'] = df[date_col].dt.is_month_end.astype(int)
return df
def create_interaction_features(self, df: pd.DataFrame,
feature_pairs: list) -> pd.DataFrame:
"""
Create interaction features from feature pairs
"""
df = df.copy()
for feat1, feat2 in feature_pairs:
df[f'{feat1}_x_{feat2}'] = df[feat1] * df[feat2]
df[f'{feat1}_div_{feat2}'] = df[feat1] / (df[feat2] + 1e-8)
df[f'{feat1}_plus_{feat2}'] = df[feat1] + df[feat2]
return df
def create_aggregation_features(self, df: pd.DataFrame, group_col: str,
agg_cols: list, agg_funcs: list) -> pd.DataFrame:
"""
Create aggregation features grouped by categorical column
"""
df = df.copy()
for agg_col in agg_cols:
for agg_func in agg_funcs:
feature_name = f'{agg_col}_{agg_func}_by_{group_col}'
df[feature_name] = df.groupby(group_col)[agg_col].transform(agg_func)
return df
from sklearn.model_selection import cross_val_score, GridSearchCV, train_test_split
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report, confusion_matrix, roc_auc_score
import xgboost as xgb
import lightgbm as lgb
class ModelTrainer:
"""
Comprehensive model training and evaluation
"""
def __init__(self):
self.models = {}
self.best_model = None
self.feature_importance = None
def train_multiple_models(self, X_train, y_train, X_val, y_val):
"""
Train multiple models and compare performance
"""
models = {
'Logistic Regression': LogisticRegression(max_iter=1000, random_state=42),
'Random Forest': RandomForestClassifier(n_estimators=100, random_state=42),
'Gradient Boosting': GradientBoostingClassifier(n_estimators=100, random_state=42),
'XGBoost': xgb.XGBClassifier(n_estimators=100, random_state=42),
'LightGBM': lgb.LGBMClassifier(n_estimators=100, random_state=42)
}
results = {}
for name, model in models.items():
print(f"\nTraining {name}...")
# Train model
model.fit(X_train, y_train)
# Cross-validation score
cv_scores = cross_val_score(model, X_train, y_train, cv=5, scoring='roc_auc')
# Validation predictions
y_pred = model.predict(X_val)
y_pred_proba = model.predict_proba(X_val)[:, 1]
# Calculate metrics
results[name] = {
'model': model,
'cv_score_mean': cv_scores.mean(),
'cv_score_std': cv_scores.std(),
'val_auc': roc_auc_score(y_val, y_pred_proba),
'classification_report': classification_report(y_val, y_pred, output_dict=True)
}
print(f"CV AUC: {cv_scores.mean():.4f} (+/- {cv_scores.std():.4f})")
print(f"Validation AUC: {results[name]['val_auc']:.4f}")
self.models = results
# Find best model
best_name = max(results.keys(), key=lambda x: results[x]['val_auc'])
self.best_model = results[best_name]['model']
print(f"\nBest Model: {best_name}")
return results
def hyperparameter_tuning(self, X_train, y_train, model_type='xgboost'):
"""
Perform hyperparameter tuning using GridSearchCV
"""
param_grids = {
'xgboost': {
'max_depth': [3, 5, 7, 9],
'learning_rate': [0.01, 0.05, 0.1],
'n_estimators': [100, 200, 300],
'min_child_weight': [1, 3, 5],
'subsample': [0.8, 0.9, 1.0],
'colsample_bytree': [0.8, 0.9, 1.0]
},
'random_forest': {
'n_estimators': [100, 200, 300],
'max_depth': [10, 20, 30, None],
'min_samples_split': [2, 5, 10],
'min_samples_leaf': [1, 2, 4],
'max_features': ['sqrt', 'log2', None]
}
}
if model_type == 'xgboost':
model = xgb.XGBClassifier(random_state=42)
elif model_type == 'random_forest':
model = RandomForestClassifier(random_state=42)
else:
raise ValueError(f"Unknown model type: {model_type}")
grid_search = GridSearchCV(
model,
param_grids[model_type],
cv=5,
scoring='roc_auc',
n_jobs=-1,
verbose=2
)
grid_search.fit(X_train, y_train)
print(f"Best parameters: {grid_search.best_params_}")
print(f"Best CV AUC: {grid_search.best_score_:.4f}")
return grid_search.best_estimator_
def analyze_feature_importance(self, model, feature_names, top_n=20):
"""
Analyze and plot feature importance
"""
if hasattr(model, 'feature_importances_'):
importance = model.feature_importances_
feature_importance_df = pd.DataFrame({
'feature': feature_names,
'importance': importance
}).sort_values('importance', ascending=False)
self.feature_importance = feature_importance_df
# Plot top N features
plt.figure(figsize=(10, 8))
plt.barh(
feature_importance_df['feature'].head(top_n),
feature_importance_df['importance'].head(top_n)
)
plt.xlabel('Importance')
plt.title(f'Top {top_n} Most Important Features')
plt.gca().invert_yaxis()
return feature_importance_df
else:
print("Model does not have feature_importances_ attribute")
return None
from sklearn.metrics import (
accuracy_score, precision_score, recall_score, f1_score,
roc_curve, auc, confusion_matrix, classification_report
)
import matplotlib.pyplot as plt
import seaborn as sns
class ModelEvaluator:
"""
Comprehensive model evaluation and visualization
"""
@staticmethod
def plot_confusion_matrix(y_true, y_pred, labels=None):
"""
Plot confusion matrix heatmap
"""
cm = confusion_matrix(y_true, y_pred)
plt.figure(figsize=(8, 6))
sns.heatmap(cm, annot=True, fmt='d', cmap='Blues',
xticklabels=labels, yticklabels=labels)
plt.title('Confusion Matrix')
plt.ylabel('True Label')
plt.xlabel('Predicted Label')
plt.tight_layout()
return cm
@staticmethod
def plot_roc_curve(y_true, y_pred_proba, models_dict=None):
"""
Plot ROC curve for single or multiple models
"""
plt.figure(figsize=(10, 8))
if models_dict is None:
# Single model
fpr, tpr, _ = roc_curve(y_true, y_pred_proba)
roc_auc = auc(fpr, tpr)
plt.plot(fpr, tpr, lw=2,
label=f'ROC curve (AUC = {roc_auc:.3f})')
else:
# Multiple models
for name, proba in models_dict.items():
fpr, tpr, _ = roc_curve(y_true, proba)
roc_auc = auc(fpr, tpr)
plt.plot(fpr, tpr, lw=2,
label=f'{name} (AUC = {roc_auc:.3f})')
plt.plot([0, 1], [0, 1], 'k--', lw=2, label='Random Classifier')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver Operating Characteristic (ROC) Curve')
plt.legend(loc='lower right')
plt.grid(alpha=0.3)
@staticmethod
def comprehensive_evaluation(y_true, y_pred, y_pred_proba):
"""
Generate comprehensive evaluation metrics
"""
metrics = {
'accuracy': accuracy_score(y_true, y_pred),
'precision': precision_score(y_true, y_pred, average='weighted'),
'recall': recall_score(y_true, y_pred, average='weighted'),
'f1_score': f1_score(y_true, y_pred, average='weighted'),
'roc_auc': roc_auc_score(y_true, y_pred_proba) if y_pred_proba is not None else None
}
print("Model Performance Metrics:")
print("=" * 50)
for metric, value in metrics.items():
if value is not None:
print(f"{metric:.<30} {value:.4f}")
print("\nClassification Report:")
print("=" * 50)
print(classification_report(y_true, y_pred))
return metrics
import mlflow
import mlflow.sklearn
from datetime import datetime
class MLflowTracker:
"""
MLflow experiment tracking integration
"""
def __init__(self, experiment_name: str):
mlflow.set_experiment(experiment_name)
self.experiment_name = experiment_name
def log_training_run(self, model, X_train, y_train, X_val, y_val,
params: dict, model_name: str):
"""
Log complete training run to MLflow
"""
with mlflow.start_run(run_name=f"{model_name}_{datetime.now().strftime('%Y%m%d_%H%M%S')}"):
# Log parameters
mlflow.log_params(params)
# Train model
model.fit(X_train, y_train)
# Make predictions
y_pred_train = model.predict(X_train)
y_pred_val = model.predict(X_val)
y_pred_proba_val = model.predict_proba(X_val)[:, 1]
# Calculate metrics
train_accuracy = accuracy_score(y_train, y_pred_train)
val_accuracy = accuracy_score(y_val, y_pred_val)
val_auc = roc_auc_score(y_val, y_pred_proba_val)
val_f1 = f1_score(y_val, y_pred_val, average='weighted')
# Log metrics
mlflow.log_metric("train_accuracy", train_accuracy)
mlflow.log_metric("val_accuracy", val_accuracy)
mlflow.log_metric("val_auc", val_auc)
mlflow.log_metric("val_f1", val_f1)
# Log model
mlflow.sklearn.log_model(model, "model")
# Log feature importance if available
if hasattr(model, 'feature_importances_'):
feature_importance = pd.DataFrame({
'feature': X_train.columns,
'importance': model.feature_importances_
}).sort_values('importance', ascending=False)
feature_importance.to_csv('feature_importance.csv', index=False)
mlflow.log_artifact('feature_importance.csv')
print(f"Run logged to MLflow: {mlflow.active_run().info.run_id}")
return model
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import joblib
import numpy as np
# Load model
model = joblib.load('model.pkl')
preprocessor = joblib.load('preprocessor.pkl')
app = FastAPI(title="ML Model API", version="1.0.0")
class PredictionInput(BaseModel):
features: dict
class PredictionOutput(BaseModel):
prediction: int
probability: float
prediction_id: str
@app.post("/predict", response_model=PredictionOutput)
async def predict(input_data: PredictionInput):
"""
Make prediction using trained model
"""
try:
# Convert input to DataFrame
df = pd.DataFrame([input_data.features])
# Preprocess
X = preprocessor.transform(df)
# Predict
prediction = model.predict(X)[0]
probability = model.predict_proba(X)[0][1]
# Generate prediction ID
prediction_id = f"pred_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
return PredictionOutput(
prediction=int(prediction),
probability=float(probability),
prediction_id=prediction_id
)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
@app.get("/health")
async def health_check():
return {"status": "healthy", "model_loaded": model is not None}
Remember: Good ML is iterative. Start simple, measure everything, and improve systematically.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Python, Pandas, NumPy, Matplotlib, PyTorch, TensorFlow, scikit-learn, MLflow
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job