machine-learning-mathematics

machine-learning-mathematics is a skill for Claude Code, Codex from hamzabellouch/agent-skills. It costs 63 tokens per session (486 once invoked), scanned A, original, MIT.

A guide to the mathematics behind machine learning and artificial intelligence. It explains models, optimization, probability, neural networks, backpropagation, attention, and why learning methods behave as they do.

In plain words
What is it for?
Use it for deriving loss functions and gradients, understanding gradient descent, regularization, generalization, neural networks, transformers, and generative models.
Why use it?
It helps clarify the equations and assumptions behind training models instead of treating machine-learning tools as black boxes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for deriving loss functions and gradients, understanding gradient descent, regularization, generalization, neural networks, transformers, and generative models.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hamzabellouch/agent-skills/machine-learning-mathematics
Install

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.

Any agent
npx skills add hamzabellouch/agent-skills --skill machine-learning-mathematics
Clone the repo
git clone --depth 1 https://github.com/hamzabellouch/agent-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for machine-learning-mathematics

README.md
[![agentmods](https://agentmods.dev/badge/skills/hamzabellouch/agent-skills/machine-learning-mathematics/github.svg)](https://agentmods.dev/skills/hamzabellouch/agent-skills/machine-learning-mathematics)
Your own site
<a href="https://agentmods.dev/skills/hamzabellouch/agent-skills/machine-learning-mathematics"><img src="https://agentmods.dev/badge/skills/hamzabellouch/agent-skills/machine-learning-mathematics/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.

agentmods 80×15 button for machine-learning-mathematics

Your own site · 80×15
<a href="https://agentmods.dev/skills/hamzabellouch/agent-skills/machine-learning-mathematics"><img src="https://agentmods.dev/badge/skills/hamzabellouch/agent-skills/machine-learning-mathematics.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 486 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00063 $0.00486
Opus 5.5 $0.00025 $0.00194
Sonnet 5.5 $0.00013 $0.00097
Haiku 4.5 $0.00006 $0.00049

Measured today against content hash ff0dfec2c861, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

machine-learning-mathematics 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 today.

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.

Math/Math_Master_Library/machine-learning-mathematics/SKILL.md · 26 lines

What it actually says

Mathematics of Machine Learning

Supervised learning

  • Empirical risk minimization; loss functions (MSE, cross-entropy, hinge); regularization (L2 = Gaussian prior, L1 = Laplace prior / sparsity).
  • Linear regression normal equations; logistic regression gradient X^T(sigma(Xw) - y); softmax cross-entropy gradient p - y.
  • Bias-variance decomposition; VC dimension; PAC learning; Rademacher complexity; generalization bounds; double descent and overparameterization.
  • SVM and kernels: Mercer kernels, RBF, representer theorem; Gaussian processes.

Neural networks

  • Forward pass, backpropagation = reverse-mode automatic differentiation via the chain rule; Jacobian-vector products; vanishing/exploding gradients; initialization (Xavier, He); batch/layer norm; residual connections; universal approximation theorem.
  • Optimizers: SGD, momentum, Adam; learning-rate schedules; loss landscape, saddle points, flat minima.
  • CNN: convolution as shared-weight linear operator; equivariance. RNN/LSTM. Transformers: attention softmax(QK^T/sqrt(d))V, positional encodings, scaling laws, complexity O(n^2 d).
  • Generative models: VAE (ELBO = E log p(x|z) - KL(q||p)), GAN (minimax), diffusion (score matching, SDE), autoregressive LMs (maximum likelihood on next-token).
  • Reinforcement learning: MDP, Bellman equation, policy gradient theorem, Q-learning, PPO, RLHF.

Unsupervised & probabilistic

PCA (eigenvectors of covariance, SVD), k-means (EM special case), EM algorithm, Gaussian mixtures, HMMs, graphical models, variational inference, MCMC, t-SNE/UMAP, contrastive learning, mutual information bounds.

Practical math checks

Gradient checking with finite differences; dimensional analysis of tensor shapes; numerical stability (log-sum-exp); calibration; data leakage; reproducibility.

Files

What ships with it

1 file 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.

Changes

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.

  1. today First seen · 26 lines · 63 tokens per session scan A ff0dfec2c861

Subscribe to this mod's changes

machine-learning-mathematics is a skill published in the GitHub repository hamzabellouch/agent-skills (8 stars, last pushed today), licensed MIT. It adds 63 tokens to every session and 486 once invoked, about $0.0003 per session on Opus 5.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-10-17.