Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Raibows/MLinRust
/ functions
Functions
205 in github.com/Raibows/MLinRust
⨍
Functions
205
◇
Types & classes
45
↓ 66 callers
Method
len
return the num of the samples of the dataset
src/dataset/mod.rs:156
↓ 49 callers
Method
iter_mut
expicitly create a batch iterator if you don't want it into iter
src/dataset/dataloader.rs:95
↓ 39 callers
Method
reshape
(&self, source: &Vec<usize>)
src/ndarray/mod.rs:25
↓ 23 callers
Method
into_iter
(self)
src/dataset/mod.rs:56
↓ 22 callers
Function
max
non-inplace operation: max element of the specific dim
src/ndarray/utils.rs:151
↓ 15 callers
Method
data_as_mut_vector
data borrowed as mutable
src/ndarray/mod.rs:406
↓ 11 callers
Method
dim
return the dimension, i.e., self.shape.len()
src/ndarray/mod.rs:179
↓ 11 callers
Method
split_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 callers
Function
evaluate
evaluate classification dataset<usize> data: &Dataset<usize> or &mut Dataloader<usize, &Dataset<usize>> return: (correct_num, accuracy)
src/utils.rs:44
↓ 9 callers
Method
data_as_vector
data borrowed as immutable
src/ndarray/mod.rs:411
↓ 9 callers
Method
get
return a feature-label pair (x, y) by the given index
src/dataset/mod.rs:198
↓ 9 callers
Method
permute
rearrange the dimension (axis); faster than original permute(implemented by recursive call) 20x think about the matrix transpose
src/ndarray/mod.rs:235
↓ 9 callers
Function
universal_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 callers
Method
feature_len
return the feature size of the sample
src/dataset/mod.rs:161
↓ 7 callers
Function
gather_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 callers
Method
repeat
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 callers
Method
destroy
take self, return (shape, 1d data)
src/ndarray/mod.rs:401
↓ 6 callers
Method
gen_f32
generate rand f32 from [0.0, 1.0)
src/utils.rs:129
↓ 6 callers
Method
nearest
(&'a self, query: &Vec<f32>)
src/model/knn.rs:71
↓ 6 callers
Function
softmax
inplace operation: softmax the given specific dim
src/ndarray/utils.rs:70
↓ 5 callers
Method
gen_range
generate rand usize(u32)/f32/i32 from [lower, upper)
src/utils.rs:134
↓ 5 callers
Function
minkowski_distance
known as: p = 1.0: manhattan distance p = 2.0: euclidean distance p ~ 80.0: infinity
src/model/utils.rs:7
↓ 5 callers
Method
next
(&mut self)
src/dataset/mod.rs:41
↓ 5 callers
Method
print_self
print the structure of the built tree
src/model/decision_tree.rs:208
↓ 5 callers
Function
universal_ops_inplace
ops: do something to &mut left element with &right element use: - point product - add - sub
src/ndarray/ops.rs:18
↓ 4 callers
Method
backward
backward chain, calculate gradient for each module bp_grad: usually be the output of criterion.forward
src/model/nn/mod.rs:102
↓ 4 callers
Method
forward_as_borrow
(&self, input: &NdArray)
src/model/nn/mod.rs:92
↓ 4 callers
Method
get_weighting
(&self)
src/model/knn.rs:85
↓ 4 callers
Method
multiply
(self, lhs: &NdArray)
src/ndarray/ops.rs:276
↓ 4 callers
Method
shuffle
randomly shuffle the sample index order
src/dataset/mod.rs:204
↓ 4 callers
Method
step
(&mut self, reduction: usize, lr: f32, gradient_clip_by_norm: Option<NormType>)
src/model/nn/mod.rs:110
↓ 4 callers
Method
train
build the tree by the train dataset
src/model/decision_tree.rs:121
↓ 4 callers
Method
train
train the SVM model verbose: whether show the training info
src/model/svm.rs:99
↓ 3 callers
Function
argmax
non-inplace operation: argmax
src/ndarray/utils.rs:119
↓ 3 callers
Method
calculate_information
(&self, info_gain_type: &InfoGains)
src/model/decision_tree.rs:55
↓ 3 callers
Function
check_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 callers
Method
class_num
return the num of labels if it is a classification dataset
src/dataset/mod.rs:170
↓ 3 callers
Method
clear
set all elements to 0.0
src/ndarray/mod.rs:374
↓ 3 callers
Function
evaluate_regression
evaluate regression dataset<f32> data: &Dataset<f32> or &mut Dataloader<f32, &Dataset<f32>> return: mean absolute error
src/utils.rs:62
↓ 3 callers
Method
forward
(&mut self, input: &NdArray, required_grad: bool)
src/model/nn/linear.rs:19
↓ 3 callers
Function
min
non-inplace operation: min element of the specific dim
src/ndarray/utils.rs:143
↓ 3 callers
Function
multiply
(lhs: &NdArray, rhs: &NdArray)
src/ndarray/ops.rs:226
↓ 3 callers
Function
normalize_dataset
(dataset: &mut Dataset<T>, scaler: ScalerType)
src/dataset/utils.rs:73
↓ 3 callers
Method
one_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 callers
Method
partial_cmp
(&self, other: &Self)
src/model/knn.rs:40
↓ 3 callers
Function
sum_ndarray
non-inplace operation: sum the given specific dim
src/ndarray/utils.rs:111
↓ 2 callers
Method
backward
(&mut self, bp_grad: NdArray)
src/model/nn/linear.rs:40
↓ 2 callers
Function
calculate_penalty_grad
calculate the gradients of penalty loss
src/model/utils.rs:72
↓ 2 callers
Method
dataloader_iter
(self, batch: usize)
src/utils.rs:17
↓ 2 callers
Method
forward
(&self, x: &NdArray)
src/model/svm.rs:40
↓ 2 callers
Method
forward
forward process
src/model/linear_regression.rs:26
↓ 2 callers
Method
forward
forward process
src/model/logistic_regression.rs:26
↓ 2 callers
Method
forward
(&mut self, input: &NdArray, required_grad: bool)
src/model/nn/mod.rs:84
↓ 2 callers
Method
forward
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 callers
Method
get_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 callers
Method
get_unique_feature_values
return the unique value set of a specific feature X_i
src/dataset/mod.rs:185
↓ 2 callers
Function
gradient_clip
clip the gradient according to its norm
src/model/utils.rs:40
↓ 2 callers
Function
impute_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 callers
Method
point_multiply
point product or Hadamard Product (can be broadcasted)
src/ndarray/mod.rs:416
↓ 2 callers
Method
predict_with_batch
(&self, features: &NdArray)
src/model/nn/mod.rs:125
↓ 2 callers
Function
process_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 callers
Function
relu
max(0.0, x) \[0.0, +∞\]
src/ndarray/utils.rs:220
↓ 2 callers
Method
shuffle
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 callers
Function
sigmoid
1 / (1 + exp(-x)) \[0.0, 1.0\]
src/ndarray/utils.rs:183
↓ 2 callers
Method
squeeze
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 callers
Method
step
(&mut self, reduction: usize, lr: f32, gradient_clip_by_norm: Option<NormType>)
src/model/nn/linear.rs:54
↓ 2 callers
Function
tanh
2sigmoid(2x) - 1 \[-1.0, 1.0\]
src/ndarray/utils.rs:202
↓ 2 callers
Method
weight_init
init the weights with random number from \[0, 1.0\] seed: default is set to 0
src/model/nn/mod.rs:75
↓ 2 callers
Method
weight_mut_borrow
(&mut self)
src/model/nn/linear.rs:77
↓ 1 callers
Method
build_trees
(&mut self, dataset: Dataset<T>, current_depth: usize)
src/model/decision_tree.rs:127
↓ 1 callers
Function
calculate_penalty_value
calculate the punalty loss
src/model/utils.rs:59
↓ 1 callers
Method
choice
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 callers
Function
collect_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 callers
Method
gaussian_dist_pdf
gaussian distribution point estimation, only for calculating the likelihood
src/model/naive_bayes.rs:46
↓ 1 callers
Method
gen_u32
Watch out the range, [0, 2^31 - 1] instead of uszie::max 2^64 - 1
src/utils.rs:123
↓ 1 callers
Function
get_2d_line_w_b
(model: &SupportVectorMachine)
src/model/svm.rs:192
↓ 1 callers
Method
get_best_split
traverse all possible feature values to find the best split (the max info gain)
src/model/decision_tree.rs:146
↓ 1 callers
Method
get_leaf_value
(&self)
src/model/decision_tree.rs:44
↓ 1 callers
Method
gradient_backward
update weight and bias gradient calculation is by average return: (margin/structure risk, avg_hinge_loss)
src/model/svm.rs:52
↓ 1 callers
Method
init_batches
(&mut self)
src/dataset/dataloader.rs:77
↓ 1 callers
Function
mean
non-inplace operation: mean
src/ndarray/utils.rs:135
↓ 1 callers
Method
one_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 callers
Method
predict
(&self, feature: &Vec<f32>)
src/model/naive_bayes.rs:109
↓ 1 callers
Method
predict
(&self, feature: &Vec<f32>)
src/model/svm.rs:150
↓ 1 callers
Function
process_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 callers
Function
process_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 callers
Method
recursive_nearest
return: MaxHeap<queryrecord>
src/model/knn.rs:138
↓ 1 callers
Method
recursive_print
(&self, node: &Option<Box<Node<T>>>, depth: usize)
src/model/decision_tree.rs:192
↓ 1 callers
Function
retrieval_by_recursive
retrieval from the specified dim
src/ndarray/utils.rs:76
↓ 1 callers
Method
save_grad_graph
save the activation values
src/model/nn/linear.rs:94
↓ 1 callers
Method
split_dataset_by
split the dataset into two subsets by the given (feature_idx, feature_value)
src/model/decision_tree.rs:177
↓ 1 callers
Function
std
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 callers
Method
train
train the model
src/model/naive_bayes.rs:54
↓ 1 callers
Method
weight_mut_borrow
mutablly borrow the raw data of the weights
src/model/nn/mod.rs:32
Method
add
(self, rhs: &NdArray)
src/ndarray/ops.rs:107
Method
add_assign
(&mut self, rhs: NdArray)
src/ndarray/ops.rs:64
Function
avg_value
(src_data: Vec<&f32>)
src/ndarray/utils.rs:136
Method
build
features: [batch, (feature, label)]
src/model/knn.rs:110
Method
can_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
Method
cmp
(&self, other: &Self)
src/model/knn.rs:34
next →
1–100 of 205, ranked by callers