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

MultitaskClassifier(
  obj,
  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",
  col_sample = 1,
  row_sample = 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] 137 139  43 115  55  57 126  38  84  63  78  70 130 120  75  21  87  72
#>  [19]  59  81 146   6 128 111  28  32  49  99  92 127 142  65  69 136  47  20
#>  [37]   2  62 112 141 113  10 132 124   7  61 143  36  23  34  88   4  54  29
#>  [55]  58 134 117  56  51  50  48   3  33 101  66  64  40  96 147 140  25  71
#>  [73] 150 105  22  93 100  85  53  31  46  24  60  30 102  17  26 108 145 110
#>  [91] 148  86  73 103  45   8  15  77  94  89  39  74 104  52  83 144 149 119
#> [109] 121  90 109  41 138   1  16 114  14  12  44  91
X_train <- X[index_train, ]
y_train <- y[index_train]
X_test <- X[-index_train, ]
y_test <- y[-index_train]

obj <- sklearn$linear_model$LinearRegression()
obj2 <- MultitaskClassifier(obj)
obj2$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(obj2$score(X_test, y_test))
#> Error in py_call_impl(callable, call_args$unnamed, call_args$named): AttributeError: 'MultitaskClassifier' object has no attribute 'n_classes_'
#> Run `reticulate::py_last_error()` for details.
print(obj2$predict_proba(X_test))
#> Error in py_call_impl(callable, call_args$unnamed, call_args$named): AttributeError: 'MultitaskClassifier' object has no attribute 'n_classes_'
#> Run `reticulate::py_last_error()` for details.