MCPcopy Index your code

hub / github.com/SomeB1oody/RustyML / functions

Functions3,333 in github.com/SomeB1oody/RustyML

↓ 429 callersMethodfit
Fits the PCA model Computes the mean, principal components, and variance statistics for the input data # Parameters - `x` - Feature matrix with sam
src/utils/pca.rs:328
↓ 365 callersMethodforward
Applies the activation to a pre-activation tensor `z`, returning the activated output # Parameters - `z` - Pre-activation tensor (the linear output
src/neural_network/layers/activation.rs:125
↓ 328 callersMethodpredict
Predicts class labels for samples in X # Parameters - `x` - The input samples matrix where each row is a sample # Returns - `Result<Array1<f64>, E
src/machine_learning/svm/svc.rs:419
↓ 185 callersFunctionassert_allclose
Asserts two arrays/tensors are element-wise equal within `eps` (absolute difference) For single scalars, use approx's `assert_abs_diff_eq!` / `assert
tests/neural_network/common.rs:46
↓ 178 callersMethodwith_random_state
Sets a fixed RNG seed for the random initialization path, making it reproducible (default: `None`; PCA initialization is deterministic regardless) #
src/utils/t_sne.rs:297
↓ 107 callersFunctionones
Tensor of all-ones with the given flat shape
tests/neural_network/dropout.rs:26
↓ 90 callersMethodset_training_if_mode_dependent
Sets the training mode if the layer is mode-dependent Lets layers that behave differently during training and inference switch between modes. Layers
src/neural_network/traits.rs:187
↓ 88 callersMethodset_weights
Sets the weights and bias for this layer # Parameters - `weights` - Weight matrix with shape (input_dim, output_dim) - `bias` - Bias vector with sha
src/neural_network/layers/dense.rs:172
↓ 86 callersMethodbackward
Computes the gradient with respect to the pre-activation input Every supported activation's derivative is expressible in terms of its own output, so
src/neural_network/layers/activation.rs:182
↓ 85 callersMethodadd
Adds a layer to the model Supports method chaining # Parameters - `layer` - The layer to add to the model # Returns - `&mut Self` - Mutable refer
src/neural_network/sequential.rs:197
↓ 60 callersFunctionassert_allclose
Asserts two arrays are element-wise equal within `eps` (absolute difference) Use this for array comparisons. For single scalars, use approx's `assert
tests/utils/common.rs:20
↓ 56 callersFunctiongemm_par_auto
(a: &ArrayBase<S1, Ix2>, b: &ArrayBase<S2, Ix2>)
src/math/matmul.rs:369
↓ 56 callersFunctiontensor2
Build a 2-D tensor from row-major `data` with shape `(rows, cols)`
tests/neural_network/activation.rs:26
↓ 50 callersFunctionnormalize
Normalize data along the specified axis using the given norm order Divides each element by the norm computed along the chosen axis, so the norm of th
src/utils/normalize.rs:88
↓ 50 callersFunctiontime_per_call_ns
Nanoseconds per call of `f`: the batch size grows until one batch takes >= 5 ms, then the minimum over three batches filters scheduler noise
benches/calibrations/parallel_gates/harness.rs:14
↓ 49 callersMethodwith_metric
Overrides the distance metric used for neighbor searches (default: Euclidean) # Parameters - `metric` - Distance metric to use (Euclidean, Manhattan
src/machine_learning/neighbors/knn.rs:211
↓ 43 callersMethodfit_transform
Fits the model and transforms the data Computes components and returns the projected data in a single step # Parameters - `x` - Feature matrix with
src/utils/pca.rs:385
↓ 43 callersMethodtransform
Transforms data into principal component space Projects centered data onto the fitted principal components # Parameters - `x` - Feature matrix with
src/utils/pca.rs:356
↓ 41 callersMethodwith_svd_solver
Sets the SVD solver strategy (default: `SVDSolver::Full`) # Parameters - `svd_solver` - the solver strategy to use # Returns - `Self` - the update
src/utils/pca.rs:282
↓ 39 callersFunctiont2
Build a 2-D Tensor from row-major data
tests/neural_network/sequential.rs:19
↓ 39 callersFunctiontensor2
Build a 2-D Tensor (shape [rows, cols]) from a flat Vec (row-major)
tests/neural_network/norm_batch_layer.rs:24
↓ 37 callersFunctionmake_rng
Resolves a `random_state` into a concrete RNG (see the [module docs](self) for the rules) This is the single entry point for all randomness in the cr
src/random.rs:122
↓ 35 callersMethodwith_eigen_solver
Sets the eigen solver strategy (default: `EigenSolver::Dense`) # Parameters - `eigen_solver` - the solver strategy to use # Returns - `Self` - the
src/utils/kernel_pca.rs:234
↓ 34 callersMethodcompile
Configures the optimizer and loss function for the model # Parameters - `optimizer` - The optimizer to use for training - `loss` - The loss function
src/neural_network/sequential.rs:212
↓ 34 callersFunctionvalidate_weight_shape
Validates that a weight array assigned to a layer has the shape the layer expects Layers initialize their weight arrays with the correct shape in `ne
src/neural_network/layers/validation.rs:20
↓ 34 callersMethodwith_weighting_strategy
Sets the weighting strategy for neighbor votes (default: [`WeightingStrategy::Uniform`]) # Parameters - `weighting_strategy` - uniform or distance-w
src/machine_learning/neighbors/knn.rs:192
↓ 33 callersMethodsave_to_path
Saves the model architecture and weights to a binary file at the specified path Serializes the model structure including layer types, configurations,
src/neural_network/sequential.rs:678
↓ 32 callersFunctionmake_three_class_2d
Three well-separated classes in 2D (3 samples per class), centred near (1,1), (5,5) and (9,1); ~4 units apart so every solver reaches 100% accuracy
tests/machine_learning/linear_discriminant_analysis.rs:17
↓ 31 callersMethodwith_method
Sets the gradient computation method (default: [`TSNEMethod::BarnesHut`] for `n_components <= 3`, else [`TSNEMethod::Exact`]) # Parameters - `method
src/utils/t_sne.rs:331
↓ 30 callersFunctionassert_allclose
Asserts two arrays are element-wise equal within `eps` (absolute difference) For single scalars, use approx's `assert_abs_diff_eq!` / `assert_relativ
tests/machine_learning/common.rs:20
↓ 29 callersFunctionfilled
Flat tensor filled with the given constant value
tests/neural_network/dropout.rs:31
↓ 29 callersMethodpath
(&self)
tests/neural_network/serialize.rs:45
↓ 28 callersFunctionramp
A tensor of distinct, well-separated values (gap 0.5 >> eps), so max-pooling argmax positions are unambiguous and never flip under a finite-difference
tests/neural_network/gradient_check.rs:407
↓ 28 callersMethodwith_init
Sets the embedding initialization strategy (default: [`Init::PCA`]) # Parameters - `init` - initialization strategy ([`Init::PCA`] or [`Init::Random
src/utils/t_sne.rs:311
↓ 26 callersMethodget_weights
Returns all the weights from each layer in the model Collects the weights from all layers in the sequential model and returns them as a vector of `La
src/neural_network/sequential.rs:650
↓ 26 callersMethodwith_solver
Sets the solver strategy for the LDA computation (default: `Solver::SVD`) # Parameters - `solver` - the solver to use # Returns - `Self` - the upd
src/machine_learning/discriminant_analysis/lda.rs:453
↓ 25 callersFunctiontrain_test_split
Splits a dataset into training and test sets # Parameters - `x` - Feature matrix with shape (n_samples, n_features) - `y` - Target values with shape
src/utils/train_test_split.rs:53
↓ 25 callersMethodwith_padding
Sets the padding mode (defaults to [`PaddingType::Valid`]) # Parameters - `padding` - Padding type (`Valid` or `Same`) # Returns - `Self` - The up
src/neural_network/layers/convolution/conv_3d.rs:167
↓ 25 callersMethodwith_strides
Sets the pooling strides (defaults to `pool_size`) # Parameters - `strides` - Strides of the pooling operation as (vertical stride, horizontal strid
src/neural_network/layers/pooling/max_pooling_2d.rs:137
↓ 24 callersFunctiontensor1
Build a 1-D Tensor (shape [n]) from a flat Vec
tests/neural_network/norm_batch_layer.rs:18
↓ 23 callersFunctioncheck_input_gradient_weighted
Like [`check_input_gradient`] but with a weighted loss L = sum(W * output), so it is non-degenerate for softmax and zero-mean normalization layers
tests/neural_network/gradient_check.rs:415
↓ 23 callersFunctioncreate_progress_bar
(total: u64, template: &str)
src/lib.rs:220
↓ 23 callersMethoddecision_function
Computes the decision function values for samples in X # Parameters - `x` - The input samples matrix where each row is a sample # Returns - `Resul
src/machine_learning/svm/svc.rs:478
↓ 22 callersFunctioneval_mse
MSE loss for `model.predict(x)` against `y`: mean((pred - y)^2) Matches MeanSquaredError::compute_loss so the comparison is like-for-like
tests/neural_network/optimizers.rs:59
↓ 22 callersFunctionstandardize
Standardizes data to have zero mean and unit variance Subtracts the mean and divides by the standard deviation per the chosen axis, so the standardiz
src/utils/standardize.rs:83
↓ 21 callersFunctiontwo_blobs_noise
Build the canonical 2-blob + 1-noise dataset used throughout these tests Rows 0..=3 are blob A near (0,0), rows 4..=7 are blob B near (10,10), and ro
tests/machine_learning/dbscan.rs:17
↓ 21 callersFunctionvalidate_pair
(expected: usize, found: usize, what: &str)
src/math.rs:34
↓ 21 callersMethodwith_tolerance
Sets the convergence tolerance (default: `1e-3`) # Errors - `Error::InvalidParameter` - If `tol` is non-positive or not finite
src/machine_learning/clustering/mean_shift.rs:161
↓ 20 callersFunctiongemv_par_auto
(a: &ArrayBase<S1, Ix2>, x: &ArrayBase<S2, Ix1>)
src/math/matmul.rs:453
↓ 20 callersFunctionsquared_euclidean_distance_row
( x1: &ArrayBase<S1, Ix1>, x2: &ArrayBase<S2, Ix1>, )
src/math.rs:376
↓ 20 callersFunctionvalidate_input_shape
Validates that input shape matches expected shape
src/neural_network/layers/regularization/validation.rs:28
↓ 20 callersMethodwith_max_iter
Sets the maximum number of iterations (default: `300`) # Errors - `Error::InvalidParameter` - If `max_iter` is 0
src/machine_learning/clustering/mean_shift.rs:150
↓ 19 callersFunctioncollinear_data
Collinear data: 5 points on y = 2x, rank-1 with first PC along [1/sqrt(5), 2/sqrt(5)] and sigma_1 = sqrt(50) = 5*sqrt(2)
tests/utils/pca.rs:14
↓ 19 callersFunctionwindowed_pool_forward
Forward pass for windowed pooling (`MaxPooling{1,2,3}D` / `AveragePooling{1,2,3}D`) `pool` and `strides` are the per-spatial-axis window sizes and st
src/neural_network/layers/pooling/pooling_engine.rs:147
↓ 19 callersMethodwith_bin_seeding
Enables or disables the bin-seeding initialization strategy (default: `false`) Setting this to `true` can speed up fitting on large datasets
src/machine_learning/clustering/mean_shift.rs:170
↓ 19 callersMethodwith_cluster_all
Sets whether to assign every point to a cluster, including potential noise (default: `true`)
src/machine_learning/clustering/mean_shift.rs:177
↓ 19 callersMethodwith_regularization
Enables L1 or L2 regularization to prevent overfitting (default: no regularization) # Parameters - `regularization` - the regularization variant and
src/machine_learning/linear_model/linear_regression.rs:215
↓ 18 callersMethodfit_predict
Fits the model to the training data and then predicts labels for the same data A convenience method that runs `fit` followed by `predict` # Paramete
src/machine_learning/svm/svc.rs:811
↓ 18 callersFunctionthree_blob_data
Build 3 tight, well-separated blobs of 5 points each, centred at (0,0), (10,0), (5,10) with per-coordinate offset in [-0.05, +0.05] Inter-blob separa
tests/machine_learning/kmeans.rs:19
↓ 17 callersMethodcompute_grad
(&self, y_true: &Tensor, y_pred: &Tensor)
src/neural_network/losses/mean_squared_error.rs:64
↓ 17 callersMethodcompute_loss
(&self, y_true: &Tensor, y_pred: &Tensor)
src/neural_network/losses/mean_squared_error.rs:54
↓ 17 callersFunctionlinearly_separable_binary
A tiny linearly-separable binary dataset; feature 0 is 0.x for class 0 and 1.x for class 1, so any default-param tree reaches zero training error
tests/machine_learning/decision_tree.rs:16
↓ 17 callersFunctionmcm_3class
y_true=[0,1,2,2,1], y_pred=[0,2,2,2,1] -> matrix (row=true, col=pred) [[1,0,0],[0,1,1],[0,0,2]]
tests/metrics/classification.rs:429
↓ 17 callersFunctionpreliminary_check
Performs validation checks on the input data matrices Validates that: - The input data matrix is not empty - The input data does not contain NaN or i
src/machine_learning/validation.rs:34
↓ 17 callersFunctionrand_f64
(r: usize, c: usize, seed: u64)
src/math/matmul.rs:529
↓ 17 callersFunctionround_trip
Save `model` to `path`, load into a fresh model built by `make_fresh`, and return it
tests/neural_network/serialize.rs:57
↓ 17 callersFunctionto_label_vec
Collects a `usize` label array into a contiguous `Vec`, tolerating non-contiguous views
src/metrics/clustering.rs:143
↓ 17 callersFunctiontwo_blob_data
Two well-separated unit blobs of 5 points each, near (0,0) and (20,20); with bandwidth=2.0 every intra-blob point sits inside the kernel window
tests/machine_learning/mean_shift.rs:14
↓ 17 callersMethodwith_normalized_axis
Sets the axis (or axes) along which to normalize Defaults to [`LayerNormalizationAxis::Default`] (the last dimension). Changing the axis re-sizes the
src/neural_network/layers/regularization/normalization/layer_normalization.rs:428
↓ 16 callersFunctioncheck_input_gradient
Compares `layer.backward(ones)` against a central finite-difference estimate of d sum(output)/dx
tests/neural_network/gradient_check.rs:45
↓ 16 callersFunctionlinearly_separable_data
Linearly separable 2-feature dataset in the +1/-1 label domain Class +1 sits in the upper-right quadrant, class -1 in the lower-left, so a large-marg
tests/machine_learning/svc.rs:17
↓ 16 callersFunctionmake_tensor
Helper: build a Tensor from a flat Vec and shape
src/neural_network/layers/regularization/normalization.rs:434
↓ 16 callersMethodpartial_cmp
(&self, other: &Self)
src/machine_learning/spatial.rs:58
↓ 16 callersFunctiont2
Build a 2D Tensor from row-major data
tests/neural_network/dense.rs:20
↓ 16 callersFunctionvalidate_predict_input
Validates a feature matrix passed to a `predict`-style method Performs the three checks every estimator needs before predicting, with a single consis
src/machine_learning/validation.rs:238
↓ 15 callersFunctioncheck_weight_gradient
Compares analytic parameter gradients (from `layer.parameters()` after `backward(ones)`) against a central finite-difference estimate of d sum(output)
tests/neural_network/gradient_check.rs:277
↓ 15 callersFunctionmake_separable
Return (x, y) for a perfectly linearly-separable 2-feature problem split by the boundary x1=0 (class 0 at negative x1, class 1 at positive x1)
tests/machine_learning/linear_svc.rs:13
↓ 15 callersFunctionrandom_matrix
(rows: usize, cols: usize, seed: u64)
benches/benchmarks/ml_end_to_end.rs:27
↓ 15 callersMethodset_gate_weights
( &mut self, reset_kernel: Array2<f32>, reset_recurrent_kernel: Array2<f32>, r
src/neural_network/layers/recurrent/gru.rs:219
↓ 14 callersFunctionaverage_path_length_factor
(n: usize)
src/math.rs:678
↓ 14 callersFunctionestimate_bandwidth
Estimates a bandwidth to use with the MeanShift algorithm The bandwidth is estimated from the pairwise distances between a subset of points # Parame
src/machine_learning/clustering/mean_shift.rs:605
↓ 14 callersMethodparameters
Exposes the 3 fused trainable tensors (kernel, recurrent kernel, bias) and their gradients as flat [`ParamGrad`] slices for the optimizer to update R
src/neural_network/layers/recurrent/gate.rs:113
↓ 14 callersMethodset_weights
Sets the fused weights for this GRU layer # Parameters - `kernel` - Fused input kernel with shape (input_dim, 3 * units), gate column blocks in the
src/neural_network/layers/recurrent/gru.rs:177
↓ 13 callersFunctionglobal_pool_forward
Forward pass for global pooling (`GlobalMaxPooling{1,2,3}D` / `GlobalAveragePooling{1,2,3}D`) Reduces every spatial dimension to one value per channe
src/neural_network/layers/pooling/pooling_engine.rs:432
↓ 13 callersFunctionmake_tensor
Helper: build a Tensor from a flat Vec and shape
src/neural_network/layers/regularization/normalization/layer_normalization.rs:955
↓ 13 callersFunctiontime_ns
(mut f: F)
benches/calibrations/gemm_calibrate.rs:23
↓ 13 callersMethodwith_shrinkage
Sets the shrinkage strategy for covariance estimation (default: no shrinkage) # Parameters - `shrinkage` - the shrinkage strategy # Returns - `Ok(
src/machine_learning/discriminant_analysis/lda.rs:471
↓ 13 callersMethodwith_stride
Sets the pooling stride (defaults to `pool_size`) # Parameters - `stride` - Stride of the pooling operation # Returns - `Result<Self, Error>` - Th
src/neural_network/layers/pooling/max_pooling_1d.rs:143
↓ 12 callersFunctionassert_close
Helper: assert a tensor's elements (logical order) match `expected` within `tol`
src/neural_network/layers/regularization/normalization.rs:439
↓ 12 callersMethodcontext
(self, context: impl Into<String>)
src/error.rs:315
↓ 12 callersFunctionmake_small_dataset
Small deterministic dataset for general fitting tests (8 samples x 2 features)
tests/utils/kernel_pca.rs:16
↓ 12 callersFunctionmerge_normalized_axes
Permutes the `axes` to the trailing positions and merges them into a single axis, returning the transformed contiguous tensor plus the permutation and
src/neural_network/layers/regularization/normalization/layer_normalization.rs:274
↓ 12 callersMethodpredict_proba
Predicts class probabilities for multiple samples (classification only) # Parameters - `x` - Feature matrix as a 2D array # Returns - `Result<Arra
src/machine_learning/tree/decision_tree.rs:1289
↓ 11 callersFunctionentropy_nats
Computes the entropy (in nats) of a partition from its cluster sizes: `H = -sum_i p_i * ln(p_i)`
src/metrics/clustering.rs:81
↓ 11 callersFunctionfit_separable_model
Fit a default (L2) LinearSVC on the separable dataset with enough iterations that convergence is expected, returning the trained model
tests/machine_learning/linear_svc.rs:27
↓ 11 callersFunctionregression_data
Fixed, deterministic (x, y) pair for a tiny 1-input -> 1-output regression Target y = 2*x over 4 samples; with identity weights (w=1, b=0) the initia
tests/neural_network/optimizers.rs:35
↓ 11 callersFunctionroc_curve
Computes the Receiver Operating Characteristic (ROC) curve Returns `(fpr, tpr, thresholds)`: the false-positive rate and true-positive rate at each d
src/metrics/classification.rs:1045
↓ 11 callersFunctionsmall_data
Small valid dataset (6 points, 2 features); perplexity=2.0 < 6 passes the n_samples guard
tests/utils/t_sne.rs:12
↓ 11 callersFunctiontensor2
Build a 2-D Tensor (ArrayD<f32>) from a row-major `data` vec with shape `(rows, cols)`
src/neural_network/layers/activation.rs:363
↓ 10 callersFunctionanisotropic_data
Zero-mean data with different variance per axis: PCs are the standard basis with sigma_1 = sqrt(32) > sigma_2 = sqrt(8)
tests/utils/pca.rs:20
next →1–100 of 3,333, ranked by callers