bflammers / ANN2

Neural Networks package for R with a fast C++ back-end and special support for unsupervised anomaly detection using autoencoders
GNU Lesser General Public License v3.0
13 stars 3 forks source link

viewing network weights? #11

Closed cdiekman closed 4 years ago

cdiekman commented 4 years ago

After training a network using the 'neuralnetwork' function, how can I obtain the weights in the resulting 'ann' object?

bflammers commented 4 years ago

The following example shows how to access the parameters:

library('ANN2')

X <- iris[,1:4]
y <- iris$Species

nn <- neuralnetwork(X, y, hidden.layers = c(10, 10), val.prop = 0)

params <- nn$Rcpp_ANN$getParams()
weights <- params$weights
biases <- params$biases