Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add aj-geddes/useful-ai-prompts --skill regression-modelinggit clone --depth 1 https://github.com/aj-geddes/useful-ai-promptsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/aj-geddes/useful-ai-prompts/regression-modeling)<a href="https://agentmods.dev/skills/aj-geddes/useful-ai-prompts/regression-modeling"><img src="https://agentmods.dev/badge/skills/aj-geddes/useful-ai-prompts/regression-modeling/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/aj-geddes/useful-ai-prompts/regression-modeling"><img src="https://agentmods.dev/badge/skills/aj-geddes/useful-ai-prompts/regression-modeling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- Socket pass
- Snyk pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00028 | $0.02579 |
| Opus 5 | $0.00014 | $0.01290 |
| Sonnet 5 | $0.00006 | $0.00516 |
| Haiku 4.5 | $0.00003 | $0.00258 |
Grade A, and why
Regression Modeling scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 280 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Regression Modeling
Overview
Regression modeling predicts continuous target values based on input features, establishing quantitative relationships between variables for forecasting and analysis.
When to Use
- Predicting sales, prices, or other continuous numerical outcomes
- Understanding relationships between independent and dependent variables
- Forecasting trends based on historical data
- Quantifying the impact of features on a target variable
- Building baseline models for comparison with more complex algorithms
- Identifying which variables most influence predictions
Regression Types
- Linear Regression: Straight-line fit to data
- Polynomial Regression: Non-linear relationships
- Ridge (L2): Regularization to prevent overfitting
- Lasso (L1): Feature selection through regularization
- ElasticNet: Combines Ridge and Lasso
- Robust Regression: Resistant to outliers
Key Metrics
- R² Score: Proportion of variance explained
- RMSE: Root Mean Squared Error
- MAE: Mean Absolute Error
- AIC/BIC: Model comparison criteria
Implementation with Python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import (
LinearRegression, Ridge, Lasso, ElasticNet, HuberRegressor
)
from sklearn.preprocessing import PolynomialFeatures, StandardScaler
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error
import seaborn as sns
# Generate sample data
np.random.seed(42)
X = np.random.uniform(0, 100, 200).reshape(-1, 1)
y = 2.5 * X.squeeze() + 30 + np.random.normal(0, 50, 200)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
# Linear Regression
lr_model = LinearRegression()
lr_model.fit(X_train, y_train)
y_pred_lr = lr_model.predict(X_test)
print("Linear Regression:")
print(f" R² Score: {r2_score(y_test, y_pred_lr):.4f}")
print(f" RMSE: {np.sqrt(mean_squared_error(y_test, y_pred_lr)):.4f}")
print(f" Coefficient: {lr_model.coef_[0]:.4f}")
print(f" Intercept: {lr_model.intercept_:.4f}")
# Polynomial Regression (degree 2)
poly = PolynomialFeatures(degree=2)
X_train_poly = poly.fit_transform(X_train)
X_test_poly = poly.transform(X_test)
poly_model = LinearRegression()
poly_model.fit(X_train_poly, y_train)
y_pred_poly = poly_model.predict(X_test_poly)
print("\nPolynomial Regression (degree=2):")
print(f" R² Score: {r2_score(y_test, y_pred_poly):.4f}")
print(f" RMSE: {np.sqrt(mean_squared_error(y_test, y_pred_poly)):.4f}")
# Ridge Regression (L2 regularization)
ridge_model = Ridge(alpha=1.0)
ridge_model.fit(X_train, y_train)
y_pred_ridge = ridge_model.predict(X_test)
print("\nRidge Regression (alpha=1.0):")
print(f" R² Score: {r2_score(y_test, y_pred_ridge):.4f}")
print(f" RMSE: {np.sqrt(mean_squared_error(y_test, y_pred_ridge)):.4f}")
# Lasso Regression (L1 regularization)
lasso_model = Lasso(alpha=0.1)
lasso_model.fit(X_train, y_train)
y_pred_lasso = lasso_model.predict(X_test)
print("\nLasso Regression (alpha=0.1):")
print(f" R² Score: {r2_score(y_test, y_pred_lasso):.4f}")
print(f" RMSE: {np.sqrt(mean_squared_error(y_test, y_pred_lasso)):.4f}")
# ElasticNet Regression
elastic_model = ElasticNet(alpha=0.1, l1_ratio=0.5)
elastic_model.fit(X_train, y_train)
y_pred_elastic = elastic_model.predict(X_test)
print("\nElasticNet Regression:")
print(f" R² Score: {r2_score(y_test, y_pred_elastic):.4f}")
print(f" RMSE: {np.sqrt(mean_squared_error(y_test, y_pred_elastic)):.4f}")
# Robust Regression (resistant to outliers)
huber_model = HuberRegressor(max_iter=1000, alpha=0.1)
huber_model.fit(X_train, y_train)
y_pred_huber = huber_model.predict(X_test)
print("\nHuber Regression (Robust):")
print(f" R² Score: {r2_score(y_test, y_pred_huber):.4f}")
print(f" RMSE: {np.sqrt(mean_squared_error(y_test, y_pred_huber)):.4f}")
# Visualization
fig, axes = plt.subplots(2, 3, figsize=(15, 8))
models_data = [
(X_test, y_test, y_pred_lr, 'Linear'),
(X_test_poly, y_test, y_pred_poly, 'Polynomial (deg=2)'),
(X_test, y_test, y_pred_ridge, 'Ridge'),
(X_test, y_test, y_pred_lasso, 'Lasso'),
(X_test, y_test, y_pred_elastic, 'ElasticNet'),
(X_test, y_test, y_pred_huber, 'Huber'),
]
for idx, (X_p, y_t, y_p, label) in enumerate(models_data):
if label in ['Polynomial (deg=2)']:
x_plot = X_p[:, 1] # Use quadratic feature for plotting
else:
x_plot = X_p
ax = axes[idx // 3, idx % 3]
ax.scatter(x_plot, y_t, alpha=0.5, label='Actual')
ax.scatter(x_plot, y_p, alpha=0.5, color='red', label='Predicted')
ax.set_title(f'{label}\nR²={r2_score(y_t, y_p):.4f}')
ax.legend()
ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
# Residual analysis
fig, axes = plt.subplots(1, 2, figsize=(12, 4))
residuals = y_test - y_pred_lr
axes[0].scatter(y_pred_lr, residuals, alpha=0.5)
axes[0].axhline(y=0, color='r', linestyle='--')
axes[0].set_title('Residual Plot')
axes[0].set_xlabel('Fitted Values')
axes[0].set_ylabel('Residuals')
axes[1].hist(residuals, bins=20, edgecolor='black')
axes[1].set_title('Residuals Distribution')
axes[1].set_xlabel('Residuals')
axes[1].set_ylabel('Frequency')
plt.tight_layout()
plt.show()
# Cross-validation
cv_scores = cross_val_score(LinearRegression(), X, y, cv=5, scoring='r2')
print(f"\nCross-validation R² scores: {cv_scores}")
print(f"Mean CV R²: {cv_scores.mean():.4f} (+/- {cv_scores.std():.4f})")
# Regularization parameter tuning
alphas = np.logspace(-3, 3, 100)
ridge_scores = []
for alpha in alphas:
ridge = Ridge(alpha=alpha)
scores = cross_val_score(ridge, X_train, y_train, cv=5, scoring='r2')
ridge_scores.append(scores.mean())
best_alpha_idx = np.argmax(ridge_scores)
best_alpha = alphas[best_alpha_idx]
plt.figure(figsize=(10, 5))
plt.semilogx(alphas, ridge_scores)
plt.axvline(x=best_alpha, color='red', linestyle='--', label=f'Best alpha={best_alpha:.4f}')
plt.xlabel('Alpha (Regularization Strength)')
plt.ylabel('Cross-validation R² Score')
plt.title('Ridge Regression: Alpha Tuning')
plt.legend()
plt.grid(True, alpha=0.3)
plt.show()
# Feature importance (coefficients)
if hasattr(lr_model, 'coef_'):
print(f"\nModel Coefficients: {lr_model.coef_}")
# Additional evaluation and diagnostics
# Model prediction intervals
from scipy import stats as sp_stats
predictions = lr_model.predict(X_test)
residuals = y_test - predictions
mse = np.mean(residuals**2)
rmse = np.sqrt(mse)
# Prediction intervals (95%)
n = len(X_test)
p = X_test.shape[1]
dof = n - p - 1
t_val = sp_stats.t.ppf(0.975, dof)
margin = t_val * np.sqrt(mse * (1 + 1/n))
pred_intervals = np.column_stack([
predictions - margin,
predictions + margin
])
print(f"\nPrediction Intervals (95%):")
print(f"First prediction: {predictions[0]:.2f} [{pred_intervals[0, 0]:.2f}, {pred_intervals[0, 1]:.2f}]")
# Variance inflation factors for multicollinearity
from statsmodels.stats.outliers_influence import variance_inflation_factor
vif_data = pd.DataFrame()
vif_data["Feature"] = X_test.columns if hasattr(X_test, 'columns') else range(X_test.shape[1])
try:
vif_data["VIF"] = [variance_inflation_factor(X.values, i) for i in range(X.shape[1])]
print("\nVariance Inflation Factor (VIF):")
print(vif_data)
except:
print("VIF calculation skipped (insufficient features)")
# Prediction by group/segment
if hasattr(X_test, 'columns'):
segment_results = {}
for feat in X_test.columns[:2]:
q1, q3 = X_test[feat].quantile([0.25, 0.75])
low = X_test[X_test[feat] <= q1]
high = X_test[X_test[feat] >= q3]
if len(low) > 0 and len(high) > 0:
low_pred_rmse = np.sqrt(np.mean((y_test[low.index] - lr_model.predict(low))**2))
high_pred_rmse = np.sqrt(np.mean((y_test[high.index] - lr_model.predict(high))**2))
segment_results[feat] = {
'Low RMSE': low_pred_rmse,
'High RMSE': high_pred_rmse,
}
if segment_results:
print(f"\nSegment Performance:")
for feat, results in segment_results.items():
print(f" {feat}: Low={results['Low RMSE']:.2f}, High={results['High RMSE']:.2f}")
print("\nRegression model evaluation complete!")
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago First seen · 280 lines · 28 tokens per session scan A 810d0f52d541
Regression Modeling is a skill published in the GitHub repository aj-geddes/useful-ai-prompts (338 stars, last pushed 6mo ago), licensed MIT. It adds 28 tokens to every session and 2,579 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
agent-platform-rag-engine-management
Manage and query Agent Platform RAG Engine Corpora and retrieve grounded contexts using the Google GenAI SDK. Use when listing RAG corpora or files, inspecting a corpus, retrieving contexts, or generating content grounded in a RAG corpus. Do not use for standard database queries (use SQL/Spanner skills), Google…
agent-platform-model-registry
Agent Platform Model Registry Management. Use when you need to upload, list, describe, update, or delete machine learning models (and their versions) in the Agent Platform Model Registry. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform models.
foundry-config-setup
Resolve missing setup caused by a hardcoded Foundry project endpoint or model in a sample. Use when a sample fails because it uses a placeholder/hardcoded projectendpoint (for example "https://your-project.services.ai.azure.com") or a hardcoded model instead of reading them from the environment.
google-cloud-solution-agentic-analytics-spark-knowledge-catalog
Discovers requirements and generates guidance to design and deploy a governed, secure agentic-analytics solution for data that's distributed across Google Cloud, other cloud providers, or on-premises. Data that's outside Google Cloud (such as data from Databricks, Snowflake, Salesforce, SAP, or Oracle systems) is…
training-check
Interactively monitor training metrics from the current Codex session, periodically checking WandB or fallback logs for NaN, divergence, plateaus, and broken runs.
nemo-automodel-launcher-config
Configure NeMo AutoModel job launches for interactive runs, Slurm clusters, and SkyPilot cloud execution.