This is plumed ANN function (annfunc) module. It implements ANN
class, which is a subclass of Function
class. ANN
class takes multi-dimensional arrays as inputs for a fully-connected feedforward neural network with specified neural network weights and generates corresponding outputs. The ANN
outputs can be used as collective variables, inputs for other collective variables, or inputs for data analysis tools.
Enable compilation by adding the --enable-modules=annfunc
to the configure command.
It is used in a similar way to other plumed functions. To define an ANN
function object, we need to define following keywords:
ARG
(string array): input variable names for the fully-connected feedforward neural networkNUM_LAYERS
(int): number of layers for the neural networkNUM_NODES
(int array): number of nodes in all layers of the neural networkACTIVATIONS
(string array): types of activation functions of layers, currently we have implemented "Linear", "Tanh", "Circular" layers, it should be straightforward to add other types as wellWEIGHTS
(numbered keyword, double array): this is a numbered keyword, WEIGHTS0
represents flattened weight array connecting layer 0 and layer 1, WEIGHTS1
represents flattened weight array connecting layer 1 and layer 2, ... An example is given in the next section.BIASES
(numbered keyword, double array): this is a numbered keyword, BIASES0 represents bias array for layer 1, BIASES1 represents bias array for layer 2, ...Assuming we have an ANN
function object named ann
, we use ann.node-0, ann.node-1, ...
to access component 0, 1, ... of its outputs (used as collective variables, inputs for other collective variables, or data analysis tools).
Assume we have an ANN with numbers of nodes being [2, 3, 1], and weights connecting layer 0 and 1 are
weights connecting layer 1 and 2 are
Bias for layer 1 and 2 are
and
respectively.
All activation functions are Tanh
.
Then if input variables are l_0_out_0, l_0_out_1
, the corresponding ANN
function object can be defined using following plumed script:
This plumed script can be generated with function Plumed_helper.get_ANN_expression()
in this repository. Following is the Python code using this function to generate the script above:
Wei Chen (UIUC, weich) and Andrew Ferguson (University of Chicago, en9@ illin ois. eduandre) wfer guson @uch icago .edu
See ./COPYRIGHT
Hosted by GitHub | 1.8.17 |