
Standardization / z-score (Geron Ch 2, morie.fn hmstz)
Source:R/geron_ml2_native.R
morie_geron_standardization.RdColumn-wise (x - mean) / sd. ddof = 0 is numpy's default
POPULATION sd, which is not R's sd(); pass ddof = 1 for the n-1
form.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_standardization(V)
#> $X_std
#> [,1]
#> [1,] -1.5275252
#> [2,] -1.0910895
#> [3,] -0.6546537
#> [4,] -0.2182179
#> [5,] 0.2182179
#> [6,] 0.6546537
#> [7,] 1.0910895
#> [8,] 1.5275252
#>
#> $Z
#> [,1]
#> [1,] -1.5275252
#> [2,] -1.0910895
#> [3,] -0.6546537
#> [4,] -0.2182179
#> [5,] 0.2182179
#> [6,] 0.6546537
#> [7,] 1.0910895
#> [8,] 1.5275252
#>
#> $mean
#> [1] 4.5
#>
#> $scale
#> [1] 2.291288
#>
#> $ddof
#> [1] 0
#>
#> $estimate
#> [1] 1.527525
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Column-wise z-score with ddof=0"
#>