MCPcopy Create free account

hub / github.com/Raibows/MLinRust / functions

Functions205 in github.com/Raibows/MLinRust

↓ 66 callersMethodlen
return the num of the samples of the dataset
src/dataset/mod.rs:156
↓ 49 callersMethoditer_mut
expicitly create a batch iterator if you don't want it into iter
src/dataset/dataloader.rs:95
↓ 39 callersMethodreshape
(&self, source: &Vec<usize>)
src/ndarray/mod.rs:25
↓ 23 callersMethodinto_iter
(self)
src/dataset/mod.rs:56
↓ 22 callersFunctionmax
non-inplace operation: max element of the specific dim
src/ndarray/utils.rs:151
↓ 15 callersMethoddata_as_mut_vector
data borrowed as mutable
src/ndarray/mod.rs:406
↓ 11 callersMethoddim
return the dimension, i.e., self.shape.len()
src/ndarray/mod.rs:179
↓ 11 callersMethodsplit_dataset
shuffle the dataset first then split it into several subsets with the given ratio ratio: the ratios of the subsets, it will be normalized first WARN
src/dataset/mod.rs:223
↓ 10 callersFunctionevaluate
evaluate classification dataset<usize> data: &Dataset<usize> or &mut Dataloader<usize, &Dataset<usize>> return: (correct_num, accuracy)
src/utils.rs:44
↓ 9 callersMethoddata_as_vector
data borrowed as immutable
src/ndarray/mod.rs:411
↓ 9 callersMethodget
return a feature-label pair (x, y) by the given index
src/dataset/mod.rs:198
↓ 9 callersMethodpermute
rearrange the dimension (axis); faster than original permute(implemented by recursive call) 20x think about the matrix transpose
src/ndarray/mod.rs:235
↓ 9 callersFunctionuniversal_ops
this is an non-in-place version of universal ops ops: do something to &mut left element with &right element
src/ndarray/ops.rs:6
↓ 8 callersMethodfeature_len
return the feature size of the sample
src/dataset/mod.rs:161
↓ 7 callersFunctiongather_by_a_specific_dim_and_do
use for kind of squezzing operations for the specific dim; fix other dimensions, then traverse and collect the specific dim to a Vec Example: - argmax
src/ndarray/utils.rs:47
↓ 7 callersMethodrepeat
if the original size of ndarray is [a, b] insert_sizes: [c, d] inplace self: [c, d, a, b]
src/ndarray/mod.rs:393
↓ 6 callersMethoddestroy
take self, return (shape, 1d data)
src/ndarray/mod.rs:401
↓ 6 callersMethodgen_f32
generate rand f32 from [0.0, 1.0)
src/utils.rs:129
↓ 6 callersMethodnearest
(&'a self, query: &Vec<f32>)
src/model/knn.rs:71
↓ 6 callersFunctionsoftmax
inplace operation: softmax the given specific dim
src/ndarray/utils.rs:70
↓ 5 callersMethodgen_range
generate rand usize(u32)/f32/i32 from [lower, upper)
src/utils.rs:134
↓ 5 callersFunctionminkowski_distance
known as: p = 1.0: manhattan distance p = 2.0: euclidean distance p ~ 80.0: infinity
src/model/utils.rs:7
↓ 5 callersMethodnext
(&mut self)
src/dataset/mod.rs:41
↓ 5 callersMethodprint_self
print the structure of the built tree
src/model/decision_tree.rs:208
↓ 5 callersFunctionuniversal_ops_inplace
ops: do something to &mut left element with &right element use: - point product - add - sub
src/ndarray/ops.rs:18
↓ 4 callersMethodbackward
backward chain, calculate gradient for each module bp_grad: usually be the output of criterion.forward
src/model/nn/mod.rs:102
↓ 4 callersMethodforward_as_borrow
(&self, input: &NdArray)
src/model/nn/mod.rs:92
↓ 4 callersMethodget_weighting
(&self)
src/model/knn.rs:85
↓ 4 callersMethodmultiply
(self, lhs: &NdArray)
src/ndarray/ops.rs:276
↓ 4 callersMethodshuffle
randomly shuffle the sample index order
src/dataset/mod.rs:204
↓ 4 callersMethodstep
(&mut self, reduction: usize, lr: f32, gradient_clip_by_norm: Option<NormType>)
src/model/nn/mod.rs:110
↓ 4 callersMethodtrain
build the tree by the train dataset
src/model/decision_tree.rs:121
↓ 4 callersMethodtrain
train the SVM model verbose: whether show the training info
src/model/svm.rs:99
↓ 3 callersFunctionargmax
non-inplace operation: argmax
src/ndarray/utils.rs:119
↓ 3 callersMethodcalculate_information
(&self, info_gain_type: &InfoGains)
src/model/decision_tree.rs:55
↓ 3 callersFunctioncheck_dim_is_legal
check whether the i32 dim (can be either forward or reverse indexing) is legal for max_dim
src/ndarray/utils.rs:4
↓ 3 callersMethodclass_num
return the num of labels if it is a classification dataset
src/dataset/mod.rs:170
↓ 3 callersMethodclear
set all elements to 0.0
src/ndarray/mod.rs:374
↓ 3 callersFunctionevaluate_regression
evaluate regression dataset<f32> data: &Dataset<f32> or &mut Dataloader<f32, &Dataset<f32>> return: mean absolute error
src/utils.rs:62
↓ 3 callersMethodforward
(&mut self, input: &NdArray, required_grad: bool)
src/model/nn/linear.rs:19
↓ 3 callersFunctionmin
non-inplace operation: min element of the specific dim
src/ndarray/utils.rs:143
↓ 3 callersFunctionmultiply
(lhs: &NdArray, rhs: &NdArray)
src/ndarray/ops.rs:226
↓ 3 callersFunctionnormalize_dataset
(dataset: &mut Dataset<T>, scaler: ScalerType)
src/dataset/utils.rs:73
↓ 3 callersMethodone_step
Forward, then calculate the loss, and update the weights. Finally return the average loss of this batch.
src/model/linear_regression.rs:33
↓ 3 callersMethodpartial_cmp
(&self, other: &Self)
src/model/knn.rs:40
↓ 3 callersFunctionsum_ndarray
non-inplace operation: sum the given specific dim
src/ndarray/utils.rs:111
↓ 2 callersMethodbackward
(&mut self, bp_grad: NdArray)
src/model/nn/linear.rs:40
↓ 2 callersFunctioncalculate_penalty_grad
calculate the gradients of penalty loss
src/model/utils.rs:72
↓ 2 callersMethoddataloader_iter
(self, batch: usize)
src/utils.rs:17
↓ 2 callersMethodforward
(&self, x: &NdArray)
src/model/svm.rs:40
↓ 2 callersMethodforward
forward process
src/model/linear_regression.rs:26
↓ 2 callersMethodforward
forward process
src/model/logistic_regression.rs:26
↓ 2 callersMethodforward
(&mut self, input: &NdArray, required_grad: bool)
src/model/nn/mod.rs:84
↓ 2 callersMethodforward
calculate the loss logits(WITHOUT softmax): the direct output of nn forward return: the initial grad for back propagation
src/model/nn/criterion.rs:22
↓ 2 callersMethodget_feature_by_idx
return the feature[idx] collections, e.g., each sample has 3 features (x, y, z), then return (x1, x2, ..., xn) if feature_idx = 0
src/dataset/mod.rs:177
↓ 2 callersMethodget_unique_feature_values
return the unique value set of a specific feature X_i
src/dataset/mod.rs:185
↓ 2 callersFunctiongradient_clip
clip the gradient according to its norm
src/model/utils.rs:40
↓ 2 callersFunctionimpute_missing_values
impute missing values in the dataset res: should be the results of the dataset preprocessing filled: ImputeType {Mean, Zero, Specific Value f32}
src/dataset/utils.rs:19
↓ 2 callersMethodpoint_multiply
point product or Hadamard Product (can be broadcasted)
src/ndarray/mod.rs:416
↓ 2 callersMethodpredict_with_batch
(&self, features: &NdArray)
src/model/nn/mod.rs:125
↓ 2 callersFunctionprocess_tianchi_car_price_regression_dataset
receipe of loading [Alibaba/tianchi Car Price](https://tianchi.aliyun.com/dataset/108588) dataset, a regression task. it may have missing values, so
src/dataset/car_price_dataset.rs:8
↓ 2 callersFunctionrelu
max(0.0, x) \[0.0, +∞\]
src/ndarray/utils.rs:220
↓ 2 callersMethodshuffle
provable evenly shuffle each element is swapped with **equal probability** to any positions ## proof: for the last element, there is no probability
src/utils.rs:146
↓ 2 callersFunctionsigmoid
1 / (1 + exp(-x)) \[0.0, 1.0\]
src/ndarray/utils.rs:183
↓ 2 callersMethodsqueeze
squeeze the specify dimension dim: a negative number means you can use the reverse ordering note that the shape of specified dim needs to be strictly
src/ndarray/mod.rs:382
↓ 2 callersMethodstep
(&mut self, reduction: usize, lr: f32, gradient_clip_by_norm: Option<NormType>)
src/model/nn/linear.rs:54
↓ 2 callersFunctiontanh
2sigmoid(2x) - 1 \[-1.0, 1.0\]
src/ndarray/utils.rs:202
↓ 2 callersMethodweight_init
init the weights with random number from \[0, 1.0\] seed: default is set to 0
src/model/nn/mod.rs:75
↓ 2 callersMethodweight_mut_borrow
(&mut self)
src/model/nn/linear.rs:77
↓ 1 callersMethodbuild_trees
(&mut self, dataset: Dataset<T>, current_depth: usize)
src/model/decision_tree.rs:127
↓ 1 callersFunctioncalculate_penalty_value
calculate the punalty loss
src/model/utils.rs:59
↓ 1 callersMethodchoice
randomly choose samples from the given array arr: the pool of candidates num: the number of you want; **note that the num should <= arr.len() if w/o r
src/utils.rs:161
↓ 1 callersFunctioncollect_by_recursive_then_gather_to
the base worker function; it will be called by gather_by_a_specific_dim_and_do
src/ndarray/utils.rs:17
↓ 1 callersMethodgaussian_dist_pdf
gaussian distribution point estimation, only for calculating the likelihood
src/model/naive_bayes.rs:46
↓ 1 callersMethodgen_u32
Watch out the range, [0, 2^31 - 1] instead of uszie::max 2^64 - 1
src/utils.rs:123
↓ 1 callersFunctionget_2d_line_w_b
(model: &SupportVectorMachine)
src/model/svm.rs:192
↓ 1 callersMethodget_best_split
traverse all possible feature values to find the best split (the max info gain)
src/model/decision_tree.rs:146
↓ 1 callersMethodget_leaf_value
(&self)
src/model/decision_tree.rs:44
↓ 1 callersMethodgradient_backward
update weight and bias gradient calculation is by average return: (margin/structure risk, avg_hinge_loss)
src/model/svm.rs:52
↓ 1 callersMethodinit_batches
(&mut self)
src/dataset/dataloader.rs:77
↓ 1 callersFunctionmean
non-inplace operation: mean
src/ndarray/utils.rs:135
↓ 1 callersMethodone_step
Forward, then calculate the loss, and update the weights. Finally return the average loss of this batch.
src/model/logistic_regression.rs:33
↓ 1 callersMethodpredict
(&self, feature: &Vec<f32>)
src/model/naive_bayes.rs:109
↓ 1 callersMethodpredict
(&self, feature: &Vec<f32>)
src/model/svm.rs:150
↓ 1 callersFunctionprocess_iris_dataset
recipe of loading [Iris Flower](https://www.kaggle.com/datasets/arshid/iris-flower-dataset) dataset, a classification task
src/dataset/iris_dataset.rs:4
↓ 1 callersFunctionprocess_mobile_phone_price_dataset
recipe of loading [Mobile Price Classification](https://www.kaggle.com/datasets/iabhishekofficial/mobile-price-classification) dataset
src/dataset/mobile_phone_price_predict.rs:4
↓ 1 callersMethodrecursive_nearest
return: MaxHeap<queryrecord>
src/model/knn.rs:138
↓ 1 callersMethodrecursive_print
(&self, node: &Option<Box<Node<T>>>, depth: usize)
src/model/decision_tree.rs:192
↓ 1 callersFunctionretrieval_by_recursive
retrieval from the specified dim
src/ndarray/utils.rs:76
↓ 1 callersMethodsave_grad_graph
save the activation values
src/model/nn/linear.rs:94
↓ 1 callersMethodsplit_dataset_by
split the dataset into two subsets by the given (feature_idx, feature_value)
src/model/decision_tree.rs:177
↓ 1 callersFunctionstd
following PyTorch, calculate the standard deviation with a specific dim unbiased = true: means doing an unbiased estimation, i.e., sum / (N-1) unbias
src/ndarray/utils.rs:162
↓ 1 callersMethodtrain
train the model
src/model/naive_bayes.rs:54
↓ 1 callersMethodweight_mut_borrow
mutablly borrow the raw data of the weights
src/model/nn/mod.rs:32
Methodadd
(self, rhs: &NdArray)
src/ndarray/ops.rs:107
Methodadd_assign
(&mut self, rhs: NdArray)
src/ndarray/ops.rs:64
Functionavg_value
(src_data: Vec<&f32>)
src/ndarray/utils.rs:136
Methodbuild
features: [batch, (feature, label)]
src/model/knn.rs:110
Methodcan_broadcast
judge whether lhs can be broadcasted by rhs it often needs the shape of rhs to be a (continuous and from right to left) subset of lhs's shape
src/ndarray/mod.rs:199
Methodcmp
(&self, other: &Self)
src/model/knn.rs:34
next →1–100 of 205, ranked by callers