Skip to contents

Decision-tree scale invariance: CART thresholds under x' = a*x + b (hmdtst)

Usage

morie_geron_tree_sensitivity_scale(
  X,
  y,
  a = 100,
  b = -7,
  feature = NULL,
  criterion = "gini",
  max_depth = NULL
)

Arguments

X, y

Data.

a, b

Affine transform (a > 0).

feature

Optional single column.

criterion, max_depth

CART controls.

Value

List with predictions_match, thresholds, scaled_thresholds, thresholds_match, knn_match.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_tree_sensitivity_scale(V, V)
#> $predictions_match
#> [1] TRUE
#> 
#> $predictions
#> [1] 1 2 3 4 5 6 7 8
#> 
#> $scaled_predictions
#> [1] 1 2 3 4 5 6 7 8
#> 
#> $thresholds
#> [1] 1.5 2.5 3.5 4.5 5.5 6.5 7.5
#> 
#> $scaled_thresholds
#> [1] 143 243 343 443 543 643 743
#> 
#> $expected_thresholds
#> [1] 143 243 343 443 543 643 743
#> 
#> $thresholds_match
#> [1] TRUE
#> 
#> $knn_predictions
#> [1] 2 1 2 3 4 5 6 7
#> 
#> $knn_scaled_predictions
#> [1] 2 1 2 3 4 5 6 7
#> 
#> $knn_match
#> [1] TRUE
#> 
#> $transform
#> $transform$a
#> [1] 100
#> 
#> $transform$b
#> [1] -7
#> 
#> $transform$columns
#> [1] 0
#> 
#> 
#> $estimate
#> [1] 1
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "affine rescaling experiment on CART vs a 1-NN control"
#>