Closed tpq closed 1 year ago
Thank you for your comments on the package as well as your useful suggestions. Indeed, having access to the biases may be useful when experimenting with NNs.
Based on those suggestions, in the current version of package (v.0.1.10) some methods were added to the NN module. These are: set_biases_at
, set_bias_at
, get_biases_at
and get_bias_at
.
For your example you can now write
a$set_biases_at(1,c(10,20,30,40))
to change the biases in the 4 nodes of layer @1 to 10, 20, 30 and 40 respectively, or
a$get_biases_at(3)
to get a vector containing the biases of nodes in layer @3.
The other methods, get_bias_at
and set_bias_at
allow you to specify a single node in a layer (note that nodes are numbered starting from 0) and access its bias.
See help(NN) for details.
The package v.0.1.10 can be found at the github repo and can be installed from there, see instructions here.
Once some more testing is performed it will also be submitted to CRAN. Please see here for some other modifications in the current version of package that you may find useful.
Will be happy to hear more suggestions from you and other users of the package.
If you find the aforementioned solution sufficient, please close the issue on GitHub (see here).
Best Regards, VNN
Edit: an additional note or completeness:
Unless extended by custom code, connections have 2 internal registers:
these are already accessible by methods get_weights_at
, get_weight_at
, set_weight_at
, set_misc_values_at
(there is currently no _get_misc_valuesat but this could easily be added).
Similarly, unmodified, typical nodes (processing elements, pes) have:
These are accessible by methods such as get_output_from
, set_output_at
, get_input_at
, input_at
, set_misc_values_at
(there is currently no _get_misc_valuesat but could easily be added), as well as the aforementioned new get_bias_at
etc. which were added by your suggestion .
Thus almost all of the default internal registers can be accessed for both 'reading' and 'writing' operations.
As of v.0.1.11 (available on GitHub - not yet released to CRAN) the missing get_misc_values_at
was added. Along with the other methods for accessing internal registers of nodes and connections (such biases etc - see previous comment), all internal registers are now accessible.
A better notation for accessing internal registers may be added in the future (similar to what you suggest), but at least the functionality mentioned is now available. I hope this covers the issue, so I am closing it.
Regards. VNN
Thank you so much!
Hi, great package! Love it already :)
I am starting to have a play with the code and find myself stuck on what might be a silly problem.
I would like to access the learned biases from the pe attributes of an nn object.
For example, I follow the code:
If I wish to access the bias associated with the n-th component, is there any R syntax akin to something like
a[[n]]$bias
that may let me retrieve these (and other attributes) directly from the nn topology?