Generate rotation matrices by different distributions, and it comes from the library rerf
.
Arguments
- dimX
The number of dimensions.
- randDist
The probability distribution of the random projection direction, including "Binary": \(B\{-1,1\}\) binomial distribution (default), "Norm":\(N(0,1)\) normal distribution, "Uniform": \(U(-1,1)\) uniform distribution.
- numProj
The number of projection directions (default ceiling(sqrt(
dimX
))).- dimProj
Number of variables to be projected, default dimProj="Rand": random from 1 to
dimX
.- sparsity
A real number in \((0,1)\) that specifies the distribution of non-zero elements in the random matrix. When sparsity="pois" means that non-zero elements are generated by the p(
lambda
) Poisson distribution.- prob
A probability in \((0,1)\) used for sampling from \({-1,1}\) where
prob = 0
will only sample -1 andprob = 1
will only sample 1.- lambda
Parameter of the Poisson distribution (default 1).
- catLabel
A category labels of class
list
in predictors. (default NULL, for details see Examples ofODT
)- ...
Used to handle superfluous arguments passed in using paramList.
Value
A random matrix to use in running ODT
.
Variable: Variables to be projected.
Number: Number of projections.
Coefficient: Coefficients of the projection matrix.
References
Tomita, T. M., Browne, J., Shen, C., Chung, J., Patsolic, J. L., Falk, B., ... & Vogelstein, J. T. (2020). Sparse projection oblique randomer forests. Journal of machine learning research, 21(104).
Examples
set.seed(1)
paramList <- list(dimX = 8, numProj = 3, sparsity = 0.25, prob = 0.5)
(RotMat <- do.call(RotMatRand, paramList))
#> Variable Number Coefficient
#> [1,] 1 1 1
#> [2,] 2 1 1
#> [3,] 4 1 1
#> [4,] 7 1 -1
#> [5,] 3 2 1
#> [6,] 6 2 -1
paramList <- list(dimX = 8, numProj = 3, sparsity = "pois")
(RotMat <- do.call(RotMatRand, paramList))
#> Variable Number Coefficient
#> [1,] 2 1 1
#> [2,] 7 2 1
#> [3,] 1 3 1
#> [4,] 7 3 1
#> [5,] 5 3 -1
#> [6,] 6 3 1
paramList <- list(dimX = 8, randDist = "Norm", dimProj = 5)
(RotMat <- do.call(RotMatRand, paramList))
#> Variable Number Coefficient
#> [1,] 2 1 0.80418951
#> [2,] 5 1 -0.05710677
#> [3,] 1 1 0.50360797
#> [4,] 4 1 1.08576936
#> [5,] 3 1 -0.69095384
#> [6,] 1 2 -1.28459935
#> [7,] 4 2 0.04672617
#> [8,] 3 2 -0.23570656
#> [9,] 2 2 -0.54288826
#> [10,] 5 2 -0.43331032
#> [11,] 2 3 -0.64947165
#> [12,] 5 3 0.72675075
#> [13,] 3 3 1.15191175
#> [14,] 4 3 0.99216037
#> [15,] 1 3 -0.42951311