Parameters' description can be found at https://techtonique.github.io/nnetsauce/

Ridge2Classifier(
  n_hidden_features = 5L,
  activation_name = "relu",
  a = 0.01,
  nodes_sim = "sobol",
  bias = TRUE,
  dropout = 0,
  direct_link = TRUE,
  n_clusters = 2L,
  cluster_encode = TRUE,
  type_clust = "kmeans",
  lambda1 = 0.1,
  lambda2 = 0.1,
  seed = 123L,
  backend = c("cpu", "gpu", "tpu")
)

Examples


library(datasets)

X <- as.matrix(iris[, 1:4])
y <- as.integer(iris[, 5]) - 1L

(index_train <- base::sample.int(n = nrow(X),
                                 size = floor(0.8*nrow(X)),
                                 replace = FALSE))
#>   [1]  99  35  26  13  36  28  44  54  29  93 147 116   5  56  77  92  72 126
#>  [19]  75  87  94  48  15  65 143 108  10  86  42 100  41  25 130  52  37  27
#>  [37]  73  83 149  34  63 131  76  79  49 112 142  71 141  45 111 114  47   1
#>  [55] 124 120  95  39 109   6  32  61  80  16   2 121  78  30 145  58 113 102
#>  [73]  70  68  67  46  59 129  96  82 125  97 144 106  33 146  51 140  50 128
#>  [91] 110 132  88  55  18 136  62 107 148 127  64   3 119  11  81 135  98  38
#> [109]  90  31 139 123  22  17 138  89 122 115  43 118
X_train <- X[index_train, ]
y_train <- y[index_train]
X_test <- X[-index_train, ]
y_test <- y[-index_train]

obj <- Ridge2Classifier()
obj$fit(X_train, y_train)
#> Error in py_call_impl(callable, call_args$unnamed, call_args$named): AttributeError: 'list' object has no attribute 'dtype'
#> Run `reticulate::py_last_error()` for details.
print(obj$score(X_test, y_test))
#> Error in py_call_impl(callable, call_args$unnamed, call_args$named): AttributeError: 'NoneType' object has no attribute 'predict'
#> Run `reticulate::py_last_error()` for details.
print(obj$predict_proba(X_train))
#> Error in py_call_impl(callable, call_args$unnamed, call_args$named): AttributeError: 'NoneType' object has no attribute 'predict'
#> Run `reticulate::py_last_error()` for details.