Formula reference
Mathematics you can check.
The formulas the Kaons engine knows, from sample variance to attention. Each comes with its notation, worked examples solved exactly, the mistakes implementations make, and the source it is quoted from.
Machine learning building blocks
Scaled dot-product attention
Open Scaled dot-product attentionEach query row of Q takes a weighted average of the rows of V, weighted by the softmax over keys of its scaled dot products with the rows of K. The softmax runs along each row (over keys).
Statistics
Means, variances, covariance and correlation, regression error measures and standard scores.
Arithmetic mean
stats.mean
Population variance
stats.population-variance
Sample variance
stats.sample-variance
Sample standard deviation
stats.sample-std
Sample covariance
stats.sample-covariance
Pearson correlation coefficient
stats.pearson-correlation
Standard error of the mean
stats.standard-error
Mean squared error
stats.mse
Root mean squared error
stats.rmse
Mean absolute error
stats.mae
Coefficient of determination
stats.r-squared
Standard score (z-score)
stats.z-score
Probability distributions
Densities and mass functions of standard distributions, and the normal distribution function.
Normal probability density
prob.normal-pdf
Normal log density
prob.normal-logpdf
Normal cumulative distribution function
prob.normal-cdf
Exponential probability density
prob.exponential-pdf
Poisson probability mass
prob.poisson-pmf
Binomial probability mass
prob.binomial-pmf
Gamma probability density
prob.gamma-pdf
Beta probability density
prob.beta-pdf
Student's t probability density
prob.student-t-pdf
Multivariate normal log density
prob.multivariate-normal-logpdf
Information theory
Entropy, divergences and mutual information of discrete distributions, in nats.
Linear algebra
Norms, distances, cosine similarity, determinants and the Mahalanobis distance.
Numerical methods
Stable log-sum-exp and hypotenuse, trapezoid and Simpson quadrature, polynomial evaluation and central differences.
Machine learning building blocks
Activations, classification and regression losses, normalization layers and attention.
Softmax
ml.softmax
Log-softmax
ml.log-softmax
Logistic sigmoid
ml.sigmoid
Softplus
ml.softplus
GELU (exact, erf form)
ml.gelu
GELU (tanh approximation)
ml.gelu-tanh
SiLU (swish)
ml.silu
Binary cross-entropy
ml.binary-cross-entropy
Binary cross-entropy from logits
ml.bce-with-logits
Softmax cross-entropy loss
ml.cross-entropy-loss
Huber loss
ml.huber-loss
Layer normalization
ml.layer-norm
RMS normalization
ml.rms-norm
Scaled dot-product attention
ml.attention
Special functions
Gamma, digamma, Riemann zeta and Bessel functions from their defining integrals and series.
Signal processing
The discrete Fourier transform, with complex coefficients.