Machine learning: API index¶
Find an operation by its purpose. Entries link to the complete signature and contract.
HMath.DeepLearning.Core¶
| API | Purpose |
|---|---|
| Activation | Scalar activation selector. |
| Sigmoid | Declaration and type contract below. |
| Tanh | Declaration and type contract below. |
| ReLU | Declaration and type contract below. |
| LeakyReLU | Declaration and type contract below. |
| PReLU | Declaration and type contract below. |
| ELU | Declaration and type contract below. |
| SELU | Declaration and type contract below. |
| GELU | Declaration and type contract below. |
| SiLU | Declaration and type contract below. |
| Mish | Declaration and type contract below. |
| Softplus | Declaration and type contract below. |
| Softsign | Declaration and type contract below. |
| HardSigmoid | Declaration and type contract below. |
| HardSwish | Declaration and type contract below. |
| activation | Given Activation selector then finite scalar, evaluate the selected activation. |
| activationDerivative | Evaluate the analytic first derivative with documented kink conventions and stable saturated sigmoid/tanh behavior. |
| activationExpr | Embed the checked activation and analytic custom reverse rule in an automatic differentiation graph. |
| softmax | Exponentiate stable log-softmax values; the output sums to one within floating error. |
| logSoftmax | Normalize a nonempty finite vector in log space after subtracting its maximum. |
| sparsemax | Project a finite vector onto the probability simplex using sorted active-support thresholds. |
| gatedLinearUnit | Multiply values by sigmoid(gates), requiring equal vector lengths. |
| softmaxExpr | First-order softmax reverse rule, including cross-coordinate coupling. |
| logSoftmaxExpr | First-order stable log-softmax rule; gradient rows sum to zero. |
| sparsemaxExpr | Sparsemax's piecewise-linear Jacobian. |
| ctcLossExpr | CTC graph operation on rectangular time-major log probabilities. |
| Reduction | Loss aggregation: Sum adds elementwise losses and Mean divides by their count; vector-level loss exceptions are documented by loss. |
| Sum | Declaration and type contract below. |
| Mean | Declaration and type contract below. |
| Loss | Checked loss selector,including squared/absolute error,cross entropy,KL,hinge,cosine,and parameterized Hubersmooth losses. |
| MeanSquaredError | Declaration and type contract below. |
| MeanAbsoluteError | Declaration and type contract below. |
| Huber | Declaration and type contract below. |
| SmoothL1 | Declaration and type contract below. |
| BinaryCrossEntropy | Declaration and type contract below. |
| CategoricalCrossEntropy | Declaration and type contract below. |
| NegativeLogLikelihood | Declaration and type contract below. |
| KLDivergence | Declaration and type contract below. |
| CosineLoss | Declaration and type contract below. |
| Hinge | Declaration and type contract below. |
| loss | Evaluate the selected checked loss. |
| lossGradient | Analytic derivatives with respect to predictions under the exact loss/reduction convention. |
| lossExpr | Use a constant target with symbolic prediction inputs and the matching analytic reverse rule. |
| binaryCrossEntropyLogits | Stable binary cross entropy from logits and [0,1] targets, including extreme finite logits. |
| categoricalCrossEntropyLogits | Cross entropy from one class-logit vector; nonnegative targets must sum to one. |
| regularization | Return l1sum(abs(w)) + l2/2sum(w*w); both coefficients must be finite and nonnegative. |
| contrastiveLoss | Pairwise Euclidean contrastive loss; similar=True penalizes squared distance and dissimilar pairs use the positive margin. |
| tripletLoss | Return max(0,positiveDistance-negativeDistance+margin) for equal nonempty vector dimensions. |
| focalLoss | Mean binary focal loss with alpha in [0,1], gamma>=0, and exact zero/one targets. |
| diceLoss | Soft segmentation overlap losses on [0,1] values; positive smoothing defines the empty-mask case. |
| iouLoss | Soft segmentation overlap losses on [0,1] values; positive smoothing defines the empty-mask case. |
| ctcLoss | Single sequence, time-major log-probabilities [time,class]. |
| ctcLossGradient | Given blank class index, target labels, then rectangular time-by-class log probabilities, return CTC negative log likelihood and gradient rows. |
HMath.DeepLearning.Layers¶
| API | Purpose |
|---|---|
| Training | Layer mode: Training updates/uses batch statistics; Inference uses retained running statistics. |
| Training | Declaration and type contract below. |
| Inference | Declaration and type contract below. |
| dropout | Inverted dropout. |
| spatialDropout | Sample one inverted dropout mask per N,C pair and share it across every spatial position. |
| BatchNormState | Per-channel running mean/variance and incorporated training-batch count for batch normalization. |
| BatchNormState | Declaration and type contract below. |
| runningMean | Per-channel running mean used during inference. |
| runningVariance | Per-channel running variance used during inference. |
| batchesSeen | Number of training batches incorporated into running statistics. |
| batchNorm | Population variance normalizes a training batch; unbiased sample variance updates runningVariance (a one-element batch uses population variance). |
| layerNorm | Normalize the selected number of trailing axes independently for each remaining prefix index. |
| instanceNorm | Normalize spatial axes separately per batch/channel in N,C,spatial layout. |
| groupNorm | Normalize channels/spatial positions per batch and channel group; channel count must be divisible by groups. |
| rmsNorm | Divide trailing-axis groups by sqrt(mean(x*x)+epsilon), without subtracting a mean. |
| weightNorm | Normalize each selected-axis slice and multiply it by the matching explicit magnitude; zero directions fail. |
| Initializer | Weight initializer selector: XavierKaiming uniformnormal,Orthogonal gain,or TruncatedNormal mean sigma cutoff. initializeWeights also takes explicit fan counts and RNG. |
| XavierUniform | Declaration and type contract below. |
| XavierNormal | Declaration and type contract below. |
| KaimingUniform | Declaration and type contract below. |
| KaimingNormal | Declaration and type contract below. |
| Orthogonal | Declaration and type contract below. |
| TruncatedNormal | Declaration and type contract below. |
| initializeWeights | Generate an immutable tensor and advanced RNG. |
| embedding | Gather checked row indices from [vocabulary,features] weights in requested order. |
| dense | Apply x*transpose(weights)+bias to [batch,in] inputs and [out,in] weights. |
| denseAD | Symbolic dense layer with gradients through inputs, weights, and explicit bias expressions. |
| ConvOptions | Per-axis stride,padding,dilation,and channel-group settings for checked convolution. |
| ConvOptions | Declaration and type contract below. |
| convolutionStride | Positive spatial stride per convolution axis. |
| convolutionPadding | Nonnegative symmetric padding per spatial axis. |
| convolutionDilation | Positive spacing between kernel elements per spatial axis. |
| convolutionGroups | Positive group count dividing input/output channels for grouped convolution. |
| convolution | Direct checked 1D2D3D cross-correlation with grouped channels and explicit stridepaddingdilation. |
| transposedConvolution | Direct adjoint-layout convolution; output padding is per-axis and strictly less than stride. |
| depthwiseConvolution | Set groups to input channels; output channel multipliers remain explicit in the weight shape. |
| convolutionAD | Construct the same direct convolution from scalar graph arithmetic, with automatic inputkernelbias gradients. |
| PoolMode | Pooling reduction selector: MaxPool or AveragePool over each checked window. |
| MaxPool | Declaration and type contract below. |
| AveragePool | Declaration and type contract below. |
| pooling | Windowed max/average pooling. |
| adaptivePooling | Partition spatial axes by floor/ceil output-bin boundaries, then reduce each bin. |
| globalPooling | Reduce all spatial positions to one value per N,C pair. |
| scaledDotProductAttention | Return attended values and normalized weights for Q[N,D],K[M,D],V[M,F]; True masks permit keys. |
| multiheadAttention | Split feature dimension into equal heads, attend independently, concatenate. |
| causalMask | Build a query-by-key allowed mask, with an explicit cached-prefix offset. |
| rotaryEmbedding | Rotate adjacent feature pairs at sequence positions offset+i; feature dimension must be even. |
| sinusoidalEncoding | Return [position,feature] sine/cosine positional encoding with base 10000. |
| alibiBias | Return nonpositive slope-scaled absolute position offsets; combine with a causal allowed mask if required. |
| KVCache | Opaque retained attention keys/values for incremental decoding; use checked cache append/attention operations. |
| emptyCache | Create an owned immutable key/value cache with fixed positive capacity and feature widths. |
| appendCache | Append equal-length key/value sequences without truncating history; reject capacity or feature mismatches. |
| cacheValues | Return immutable accumulated key/value tensors, preserving insertion order. |
| transformerFeedForward | Compose dense, checked elementwise activation, and dense layers with explicit parameters. |
| layerNormAD | Symbolic trailing-axis layer normalization. |
| rmsNormAD | Symbolic RMS normalization; its denominator includes all trailing axes. |
| scaledDotProductAttentionAD | First-order reverse attention graph, including Q/K score and V gradients. |
HMath.DeepLearning.Metrics¶
| API | Purpose |
|---|---|
| ClassificationMetrics | Accuracy and per-class precision,recall,and F1 values ordered by class index. |
| ClassificationMetrics | Declaration and type contract below. |
| accuracy | Fraction of correctly predicted samples. |
| precisionByClass | Per-class true positives divided by predicted positives; ordering follows class indices. |
| recallByClass | Per-class true positives divided by actual positives. |
| f1ByClass | Per-class harmonic mean of precision and recall, following the metric function's zero-denominator convention. |
| confusionMatrix | Count [trueClass,predictedClass] pairs for a positive explicit class count. |
| classificationMetrics | Return accuracy and per-class precision, recall, and F1 with zero for undefined class denominators. |
| topKAccuracy | Measure whether truth lies among descending top-k scores; equal scores prefer the smaller class index. |
| rocAUC | Compute the exact positive/negative rank-pair ROC area; both classes are required and ties count half. |
| prAUC | Integrate the precision-recall curve by grouped-score trapezoids, requiring at least one positive example. |
| perplexity | Exponentiate the negative mean true-token log probability; empty or positive log probabilities fail. |
| cosineSimilarityMatrix | Compare every [M,D] row with every [N,D] row using scale-safe unit vectors; zero vectors fail. |
| marginRankingLoss | Mean hinge on signed (+/-1) pair ordering with a nonnegative finite margin. |
HMath.DeepLearning.Precision¶
| API | Purpose |
|---|---|
| Quantization | Integer quantization policy: Symmetric around zero or Asymmetric with a learned zero point. |
| Symmetric | Declaration and type contract below. |
| Asymmetric | Declaration and type contract below. |
| QuantizedTensor | Opaque Int8 tensor with shape,optional channel axis,scales,and zero points. |
| quantize | Calibrate finite nonempty values per tensor or selected axis. |
| dequantize | Decode owned INT8 values using scale*(q-zeroPoint), rejecting floating arithmetic overflow. |
| quantizedValues | Return signed INT8 storage in logical row-major order. |
| quantizationScales | Return one positive scale per calibrated channel, or a single per-tensor scale. |
| quantizationZeroPoints | Return integer zero offsets under the selected symmetric/asymmetric calibration. |
| int8Gemm | Multiply two INT8 matrices with exact integer accumulation; supports per-row A/per-column B or per-tensor scales. |
| Precision | Mixed-precision storage/rounding selector FP16 or BF16; operations report finite/overflow conditions through the checked precision API. |
| FP16 | Declaration and type contract below. |
| BF16 | Declaration and type contract below. |
| reducedGemm | Round operands to the chosen 16-bit format, accumulate in Float32, and return checked Double values. |
| LossScaler | Dynamic mixed-precision loss-scale state with finite-step growth tracking. |
| LossScaler | Declaration and type contract below. |
| lossScale | Positive scaling factor applied to loss/gradients in mixed-precision training. |
| scaleGrowthInterval | Number of consecutive finite updates before loss-scale growth. |
| finiteSteps | Current count of consecutive finite updates since the last reset/growth. |
| initialLossScaler | Create a positive finite loss scale and positive growth interval; zero accumulated finite steps. |
| scaleLoss | Multiply a finite loss by the checked current scale; overflow is a structured failure. |
| unscaleGradients | False means overflow: every caller must skip the entire optimizer update. |
| updateLossScaler | Halve scale after overflow; double after growthInterval finite updates, with a bounded maximum. |
| gradientNorm | Compute a checked scaled Euclidean norm; unrepresentable final norms fail explicitly. |
| clipGradients | Clip norm through the shared overflow-safe automatic-differentiation gradient utility. |
HMath.MachineLearning¶
| API | Purpose |
|---|---|
| Dataset | Finite observations as rows with a fixed, positive feature count. |
| MLConfig | Positive iteration limittolerancerate and an explicit reproducible seed. |
| MLConfig | Declaration and type contract below. |
| mlIterations | Maximum outer iterations per fitted algorithm. |
| mlTolerance | Absolute algorithm-specific stopping residual. |
| mlRate | Positive gradient step size, where used. |
| mlSeed | Seed for initialization, projection, or stochastic updates. |
| defaultMLConfig | 500 iterations, absolute residual tolerance 1e-8, rate 0.05, PCG seed 42. |
| Fit | A finite budget is a valid stopping point, distinct from convergence. |
| Fit | Declaration and type contract below. |
| fitted | Best fitted model retained when fitting stops. |
| fitIterations | Completed fitting iterations. |
| fitResidual | Algorithm-specific finite stopping residual at the returned model. |
| fitConverged | Whether the selected stopping residual met tolerance; a budget stop may return False. |
HMath.MachineLearning.Clustering¶
| API | Purpose |
|---|---|
| ClusterModel | Fitted cluster centroids as cluster-by-feature observations; prediction assigns new queries to the learned centers. |
| clusterCenters | Cluster centroids as cluster-by-feature rows. |
| predictClusters | Assign each row to its closest squared-Euclidean center; ties use the first center. |
| kMeans | Seeded random-center Lloyd iteration; residual is total center displacement. |
| kMeansPlusPlus | D-squared k-means++ initialization followed by Lloyd center updates. |
| miniBatchKMeans | Online center updates with per-cluster counts and seeded shuffled batches. |
| kMedoids | PAM exhaustive medoid swaps. |
| GaussianMixture | Fitted component probabilities,mean vectors,and covariance matrices in shared component order. |
| mixtureWeights | Gaussian-mixture component probabilities in component order. |
| mixtureMeans | Component mean vectors, matching mixtureWeights order. |
| mixtureCovariances | One feature-by-feature covariance matrix per Gaussian component. |
| fitGaussianMixture | Full-covariance EM initialized by k-means++; positive ridge is added at each covariance update. |
| mixtureResponsibilities | Compute normalized posterior component probabilities with log-sum-exp stabilization. |
| dbscan | Density expansion using a positive Euclidean radius; minimumPoints includes the observation itself. |
| optics | OPTICS (Ankerst et al., SIGMOD 1999): ordered point index, core distance, reachability distance. |
| extractOPTICS | Extract DBSCAN-style labels at epsilon from a checked OPTICS ordering; noise is -1. |
| meanShift | Gaussian-kernel mean shift from every training point; modes within bandwidth/2 are merged. |
| Linkage | Single, complete, average Euclidean distance or Ward variance-increase linkage. |
| Single | Declaration and type contract below. |
| Complete | Declaration and type contract below. |
| Average | Declaration and type contract below. |
| Ward | Declaration and type contract below. |
| Merge | One hierarchical-clustering merge, retaining child IDs,linkage distance,and merged observation count. |
| Merge | Declaration and type contract below. |
| leftCluster | Left child cluster ID in a hierarchical merge. |
| rightCluster | Right child cluster ID in a hierarchical merge. |
| mergeDistance | Linkage distance at which the two child clusters merge. |
| mergedSize | Number of original observations in the merged cluster. |
| hierarchical | Agglomerate the closest active clusters to produce all n-1 linkage rows. |
| cutHierarchy | Validate the entire hierarchy and return k cluster labels in original observation order. |
| spectralClustering | Cluster row-normalized leading eigenvectors of the normalized Gaussian affinity matrix. |
| affinityPropagation | The preference is the common diagonal similarity; damping is in [0.5,1). |
HMath.MachineLearning.Decomposition¶
| API | Purpose |
|---|---|
| PCA | Fitted feature center,principal-component directions,and their explained variances; use transform functions for new observations. |
| pcaMean | Training feature means subtracted before projection. |
| pcaComponents | Principal component loading vectors in component order. |
| pcaVariances | Explained variances associated with the retained principal components. |
| fitPCA | Fit count principal axes from at least two observations; uses sample covariance (denominator n-1). |
| transformPCA | Center with the training mean and project onto retained axes; no whitening is applied. |
| inversePCA | Reconstruct original features from retained scores and restore the training mean. |
| IncrementalPCA | Exact sufficient statistics, including between-batch mean correction. |
| incrementalPCA | Create empty running covariance state for a positive feature dimension. |
| updatePCA | Merge observations by Welford updates. |
| mergePCA | Combine independent batch statistics with the between-mean scatter correction. |
| finishPCA | Extract principal axes from accumulated sample covariance; requires at least two observations. |
| KernelPCA | Centered training kernel state and normalized positive eigenvectors. |
| fitKernelPCA | Fit kernel principal axes; count must be smaller than n and within positive numerical rank. |
| transformKernelPCA | Center query kernels with training means before projection, without fitting query statistics. |
| truncatedSVD | Return reduced (U, singular values, V-transpose) from LAPACK, keeping the largest count values. |
| ICA | Training center and whitened unmixing directions; component signs/permutations are arbitrary. |
| fitICA | Symmetric FastICA with tanh nonlinearity (Hyvarinen 1999), whitening by sample covariance. |
| transformICA | Apply the fitted centering and unmixing directions to new observations. |
| FactorAnalysis | Fitted feature center,latent factor loadings,and diagonal feature-noise variances. |
| factorLoadings | Fitted feature-by-factor loading matrix. |
| factorNoise | Per-feature residual noise variances in the factor model. |
| fitFactorAnalysis | Gaussian factor-analysis EM with diagonal noise floor. |
| CCA | Paired training centers, canonical directions, and regularized canonical correlations. |
| fitCCA | Fit paired canonical directions with a strictly positive diagonal covariance ridge. |
| transformCCA | Project paired query rows with fitted training centers and canonical directions. |
| canonicalCorrelations | Singular values of the whitened cross-covariance, in descending order. |
| PLS | PLS2 regression state with predictor/response centers and a feature-by-response coefficient matrix. |
| fitPLS | PLS2 NIPALS with regression deflation; count cannot exceed the predictor rank. |
| predictPLS | Predict response rows using fitted PLS coefficients and training centers. |
| randomProjection | Seeded Gaussian projection with variance 1/dimension per coefficient. |
| classicalMDS | Classical metric MDS. |
| isomap | Build a symmetric k-neighbor graph, compute geodesics, then metric MDS. |
| tsne | Exact all-pairs t-SNE; perplexity must be strictly between one and n. |
| umap | Exact full fuzzy-set cross entropy, caller supplies fitted curve a,b. |
HMath.MachineLearning.Internal¶
| API | Purpose |
|---|---|
| Dataset | Finite observations as rows with a fixed, positive feature count. |
| MLConfig | Positive iteration limittolerancerate and an explicit reproducible seed. |
| MLConfig | Declaration and type contract below. |
| mlIterations | Maximum outer iterations per fitted algorithm. |
| mlTolerance | Absolute algorithm-specific stopping residual. |
| mlRate | Positive gradient step size, where used. |
| mlSeed | Seed for initialization, projection, or stochastic updates. |
| defaultMLConfig | 500 iterations, absolute residual tolerance 1e-8, rate 0.05, PCG seed 42. |
| Fit | A finite budget is a valid stopping point, distinct from convergence. |
| Fit | Declaration and type contract below. |
| fitted | Best fitted model retained when fitting stops. |
| fitIterations | Completed fitting iterations. |
| fitResidual | Algorithm-specific finite stopping residual at the returned model. |
| fitConverged | Whether the selected stopping residual met tolerance; a budget stop may return False. |
| finite | Test whether Double is neither NaN nor infinite. |
| checked | Validate a list of finite numerical values, returning Right () or Left NonFiniteResult. |
| require | Given condition then diagnostic, return Right () or Left InvalidArgument prefixed with ML context. |
| config | Validate positive iteration count and positive finite tolerance/learning rate of MLConfig. |
| dataset | Validate a nonempty finite rectangular observation-by-feature list with positive feature count and Int-safe size. |
| responses | Given dataset then finite response list, validate dataset and equal observationresponse count. |
| queries | Given expected feature dimension then query rows, validate every row width and finite values. |
| dot | Unchecked list inner product using zipWith; unequal lengths truncate. |
| add | Unchecked coordinatewise list addition, truncating to shorter length; checked estimator callers validate dimensions. |
| sub | Unchecked coordinatewise left-minus-right list subtraction, truncating to shorter length. |
| scale | Given scalar then coordinate list, multiply each coordinate without checked finiteness validation. |
| norm | Return scaled Euclidean norm of a coordinate list, zero for empty/all-zero input. |
| dist2 | Return squared Euclidean distance using sub and dot. |
| meanV | Return per-feature means for a nonempty equal-width dataset. |
| matmul | Unchecked dense row-list matrix multiplication via row/column dot products. |
| ident | Return n-by-n Double identity rows for a nonnegative dimension; nonpositive n gives []. |
| replace | Given index,new value,then list, replace by take/drop reconstruction. |
| matrix | Validate dataset then construct row-major Matrix Double with matching dimensions. |
| rows | Convert Matrix to dense row lists, preserving explicit zero-column row count. |
| pinv | Compute a validated dataset pseudoinverse using relative singular-value tolerance 1e-12 and return dense rows. |
| solveLS | Given dataset then response list, solve least squares through the pseudoinverse. |
| inverse | Validate a square dataset, compute pseudoinverse and require inverse reconstruction residual below 1e-6*n. |
| symmetricEigen | Validate finite square approximately symmetric dataset, symmetrize and eigendecompose. |
| argmin | Return zero-based first index of a minimum in a nonempty list. |
| argmax | Return zero-based index selected by maximumBy on a nonempty list, with later equal maxima preferred. |
| iterateFit | Deterministic reference iteration; residual is supplied by each estimator. |
| foldEither | Monadic left fold: given checked step,initial accumulator,then list, stop at first Left MathError and otherwise return final accumulator. |
| firstRow | Return the first row of nested lists, or [] for an empty outer list. |
HMath.MachineLearning.Neighbors¶
| API | Purpose |
|---|---|
| IndexKind | Axis-aligned KD partitions or enclosing Euclidean ball partitions. |
| KDTree | Declaration and type contract below. |
| BallTree | Declaration and type contract below. |
| SpatialIndex | Immutable tree retaining original observation IDs and its validated feature dimension. |
| buildIndex | Build an exact search tree with at most leafSize observations per leaf. |
| NeighborResult | Neighbor indices/distances plus visited-leaf and exhaustive-search diagnostics. |
| NeighborResult | Declaration and type contract below. |
| neighbors | Training-row indices paired with returned Euclidean distances, ordered by distance and then index. |
| visitedLeaves | Number of leaves visited against the explicit query budget. |
| exhaustive | True if the neighbor search completed its exact stopping condition; False if unexplored nodes may improve candidates. |
| nearestNeighbors | maxLeaves is a query work budget. |
| knnRegress | Average the k exact nearest training responses for each query row. |
| knnClassify | Majority vote among k exact neighbors; targets follow original training row order. |
| LSH | Seeded p-stable Euclidean hash tables retaining Gaussian projections and offset buckets. |
| buildLSH | Build tables with projections scalar hashes each and positive bucket width. |
| queryLSH | Rank matching-bucket candidates by exact distance; may return fewer than k results, including none. |
| localOutlierFactor | Training-set LOF with ties included at the kth neighbor distance. |
| IsolationForest | Owned random isolation trees with fixed training dimension and subsample size. |
| fitIsolationForest | Seeded independent isolation trees using subsamples of 2..2048 observations. |
| scoreIsolationForest | Return 2^(-mean corrected path length / expected random-tree path length); larger means more anomalous. |
| OneClassSVM | Kernel novelty detector with normalized nonnegative dual weights and learned offset. |
| fitOneClassSVM | nu-SVM dual coordinate descent: sum alpha=1, 0<=alpha<=1/(nu*n). |
| decisionOneClassSVM | Return signed novelty margins: positive indicates an inlier under the fitted kernel boundary. |
HMath.MachineLearning.Preprocessing¶
| API | Purpose |
|---|---|
| Scaling | Population z-score, unit-range, or median/IQR feature scaling. |
| Standardize | Declaration and type contract below. |
| MinMax | Declaration and type contract below. |
| RobustScale | Declaration and type contract below. |
| Scaler | Immutable training-feature centers and nonzero scales; constant columns use scale one. |
| fitScaler | Estimate one center and scale per training feature. |
| transform | Apply training centers/scales to rows with the original feature count; no state is updated. |
| inverseTransform | Undo a fitted affine scaler, including its constant-feature convention. |
| QuantileTransformer | Sorted training samples retained separately for each feature. |
| fitQuantileTransformer | Fit empirical feature quantiles using training rows only. |
| quantileTransform | Map values to [0,1]. |
| inverseQuantileTransform | Interpolate training order statistics at probabilities in [0,1]. |
| PowerTransform | Box-Cox or Yeo-Johnson with a caller-selected finite power lambda; lambda is not estimated. |
| BoxCox | Declaration and type contract below. |
| YeoJohnson | Declaration and type contract below. |
| powerTransform | Apply the selected power to features. |
| inversePowerTransform | Invert the selected power, rejecting values outside the transform range. |
| Imputation | Training-column mean, median, or a finite constant for NaN-valued observations. |
| MeanImpute | Declaration and type contract below. |
| MedianImpute | Declaration and type contract below. |
| ConstantImpute | Declaration and type contract below. |
| Imputer | Fitted replacement values; an imputer never learns from rows passed to impute. |
| fitImputer | Treat NaN as missing and reject infinities. |
| impute | Replace NaN with fitted training values while preserving observed entries and row order. |
| Encoder | Sorted distinct training categories with stable zero-based integer codes. |
| UnknownCategory | Whether a previously unseen category fails or produces an all-zero one-hot row. |
| RejectUnknown | Declaration and type contract below. |
| ZeroUnknown | Declaration and type contract below. |
| fitEncoder | Learn sorted category levels from a nonempty training label vector. |
| labelEncode | Map known categories to zero-based codes; unseen categories fail. |
| labelDecode | Recover categories from checked integer codes. |
| oneHotEncode | Emit one column per sorted training category under the explicit unknown-category policy. |
| Fold | Disjoint indices into the original dataset. |
| Fold | Declaration and type contract below. |
| trainingIndices | Zero-based original row indices assigned to training in this fold. |
| validationIndices | Zero-based original row indices held out for validation in this fold. |
| trainTestSplit | Seeded split of n row indices. |
| kFold | Partition n shuffled indices into k nonempty validation folds; each row is held out exactly once. |
| stratifiedKFold | Round-robin each shuffled class across k folds. |
| gridSearch | Minimize a user-supplied validation loss, evaluated independently for every candidate/fold. |
| randomSearch | Sample count distinct candidates from a finite set, then evaluate the supplied folds. |
HMath.MachineLearning.Regression¶
| API | Purpose |
|---|---|
| Penalty | Minimize mean squared error divided by two plus L1 and/or squared L2 coefficient penalties. |
| Ordinary | Declaration and type contract below. |
| Ridge | Declaration and type contract below. |
| Lasso | Declaration and type contract below. |
| ElasticNet | Declaration and type contract below. |
| LinearModel | Affine predictor; coefficient zero is the intercept and remaining coefficients follow feature order. |
| coefficients | Intercept followed by slopes in input feature order. |
| fitLinear | Fit affine least squares or coordinate-descent elastic net. |
| predictLinear | Predict one finite response per query row using the fitted intercept and slopes. |
| polynomialFeatures | Build univariate columns x, x^2, ..., x^degree; the regression intercept supplies the constant. |
| fitWeighted | Fit affine least squares with nonnegative observation weights. |
| fitRobust | Huber IRLS with fixed positive residual threshold, including intercept. |
| BayesianLinear | Posterior-mean linear model together with coefficient covariance, returned by Bayesian regression fitting. |
| fitBayesian | Isotropic zero-mean Gaussian prior, observation precision beta. |
| bayesianMean | Posterior-mean fitted linear model. |
| bayesianCovariance | Posterior covariance matrix of linear coefficients. |
| RecursiveLS | Owned online regression coefficients and inverse information, with fixed forgetting factor. |
| recursiveLS | Initial inverse information delta I; forgetting factor in (0,1]. |
| updateRecursiveLS | Assimilate one feature row/response using the matrix inversion lemma. |
| recursiveCoefficients | Current intercept and slopes; updating creates a new state. |
| GLMFamily | Bernoulli mean with logistic link, or nonnegative response mean with log link. |
| BinomialLogit | Declaration and type contract below. |
| PoissonLog | Declaration and type contract below. |
| GLM | Fitted generalized linear model with intercept and family-specific inverse link. |
| fitGLM | Damped Newton/IRLS with nonnegative slope ridge. |
| predictGLM | Return conditional means: probabilities for BinomialLogit, positive rates for PoissonLog. |
| MultinomialModel | Softmax class weights and sorted original integer labels. |
| fitMultinomial | Fit all class logits by full-batch gradient descent with slope ridge. |
| predictMultinomial | Return sorted (original label, probability) pairs for each observation. |
| Kernel | Positive-semidefinite linear, polynomial, or Gaussian radial basis kernel parameters. |
| LinearKernel | Declaration and type contract below. |
| PolynomialKernel | Declaration and type contract below. |
| RBFKernel | Declaration and type contract below. |
| kernel | Evaluate a checked PSD kernel on equal-length finite feature vectors. |
| SVM | Binary kernel decision state, retaining original training observations and signed dual weights. |
| fitSVM | Deterministic two-coordinate SMO for binary labels -1/+1. |
| decisionSVM | Return signed kernel margins; zero is the fitted decision boundary. |
| predictSVM | Classify margins as -1 or +1, with zero assigned +1. |
| GaussianProcess | Zero-mean Gaussian-process regression posterior with retained training covariance solve. |
| fitGaussianProcess | Fit a GP with strictly positive observation-noise variance and a checked PSD kernel. |
| predictGaussianProcess | Return posterior latent-function (mean, variance), excluding observation noise. |
| GPClassifier | Logistic Gaussian-process classifier fitted with a Laplace Gaussian posterior approximation. |
| fitGPClassifier | Newton mode fitting for 0/1 labels. |
| predictGPClassifier | Approximate class-one probabilities using the logistic Gaussian variance correction. |
| BayesFamily | Gaussian features, nonnegative multinomial counts, or binary Bernoulli features. |
| GaussianBayes | Declaration and type contract below. |
| MultinomialBayes | Declaration and type contract below. |
| BernoulliBayes | Declaration and type contract below. |
| NaiveBayes | Fitted class priors and family-specific independent feature likelihoods. |
| fitNaiveBayes | Fit class likelihoods. |
| predictNaiveBayes | Select the class with greatest log posterior; preserve the original integer labels. |
| Discriminant | Class priors, means, and regularized inverse covariance/log-determinant state. |
| fitDiscriminant | False = pooled covariance LDA; True = class covariance QDA. |
| predictDiscriminant | Classify with Gaussian discriminant log likelihoods using training covariance state. |