fawda123 / NeuralNetTools

R package of generic neural network tools
https://fawda123.github.io/NeuralNetTools/
Creative Commons Zero v1.0 Universal
71 stars 20 forks source link

Question: olden with Keras model #21

Closed nba2020 closed 4 years ago

nba2020 commented 4 years ago

Is the olden() function able to take as mod_in input a NN model that was produced from the Keras package in R?

fawda123 commented 4 years ago

No, the functions in this package only work for objects from the nnet, neuralnet, RSNNS, and caret packages. However, there is a numeric method where you can manually input the weights to get the results:

# B1-H1, I1-H1, I2-H1, B1-H2, I1-H2, I2-H2, B2-O1, H1-O1, H2-O1.
wts_in <- c(13.12, 1.49, 0.16, -0.11, -0.19, -0.16, 0.56, -0.52, 0.81)
struct <- c(2, 2, 1) #two inputs, two hidden, one output 

olden(wts_in, struct)
nba2020 commented 4 years ago

OK, thank for clarifying @fawda123 :)