Keraflow
Deep Learning for Python.
|
You could initialize a layer's parameters with numpy arrays by setting the layer's initial_weights
argument
Note that you could also pass a list to the initial_weights
argument.
To know the number of parameters, their name, and their order (for applying the list initialization method), you need to check the manual for each layer.
You could also specify initial_weights
for partial parameters. For the dict method, just specify the parameters to be adopted. For the list method, we use the first come first serve strategy, i.e. [np.array([[1,2],[3,4]])]
will only specify weights for W
.
Note that, for flexibility, initial_weights
accepts single nD list or a single numpy array.
Both are equivalent to:
However, this only specifies initial weight for the first parameter and hence should be use with care.
You could also initialize layer parameters with initializing function. Keraflow implements some 'rule-of-thumb' methods as listed below. You could set the initializing function thorough each layer's init
argument.
You can also pass an Theano/TensorFlow function to the init
argument:
or utilize an existing Keraflow initializing function:
Note that the function must take two arguments and return a Theano/Tensorflow variable:
shape
: shape of the variable to initializename
: name of the variable