Ridge2MultitaskClassifier.Rd
Parameters' description can be found at https://techtonique.github.io/nnetsauce/
Ridge2MultitaskClassifier(
n_hidden_features = 5L,
activation_name = "relu",
a = 0.01,
nodes_sim = "sobol",
bias = TRUE,
dropout = 0,
n_clusters = 2L,
cluster_encode = TRUE,
type_clust = "kmeans",
lambda1 = 0.1,
lambda2 = 0.1,
seed = 123L,
backend = c("cpu", "gpu", "tpu")
)
# Example 1 -----
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] 89 143 123 35 30 69 130 23 21 19 137 104 32 48 15 147 55 125
#> [19] 17 71 77 13 78 68 25 29 53 16 41 112 9 37 54 86 110 108
#> [37] 117 24 14 146 109 62 40 95 39 101 72 121 140 65 149 26 46 100
#> [55] 107 63 142 81 106 131 45 47 76 98 83 60 114 132 120 97 31 38
#> [73] 33 85 139 5 96 122 119 87 148 6 52 91 8 43 134 127 113 75
#> [91] 103 128 1 88 135 4 56 67 18 10 12 102 3 99 50 57 66 84
#> [109] 61 141 79 138 2 105 44 74 150 111 73 42
X_train <- X[index_train, ]
y_train <- y[index_train]
X_test <- X[-index_train, ]
y_test <- y[-index_train]
obj <- Ridge2MultitaskClassifier()
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.