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

olden.default fails if there are more than 9 output levels #18

Closed taunometsalu closed 6 years ago

taunometsalu commented 6 years ago

If the output layer has more than 9 levels, the following row gives an error:

hid_out <- wts_in[[grep(paste('out', out_ind), names(wts_in))]][-1]

It finds both "out 1" and "out 10", grep gives output of length 2. It seems that simply taking the first occurence fixes the issue:

hid_out <- wts_in[[grep(paste('out', out_ind), names(wts_in))[1]]][-1]

fawda123 commented 6 years ago

Fixed d4d843d9e748d564c1e0982fd707b98872de1d1d

This is more explicit:

hid_out <- wts_in[[paste('out', out_ind)]][-1]

Not sure why I ever used grep for that.