Interface Parameters
- All Known Implementing Classes:
CRFParameters,LinearParameters
public interface Parameters
An interface to a
Tensor[] array which accepts updates to the parameters.
Parameters is essentially an SGD model at training time.
Subclasses of this should add methods for calculating gradients for their prediction task.
-
Method Summary
Modifier and TypeMethodDescriptionTensor[]get()Get a reference to the underlyingTensorarray.Tensor[]Generates an empty copy of the underlyingTensorarray.Tensor[]Merge together an array of gradient arrays.voidSet the underlyingTensorarray to newWeights.voidApply gradients to the parameters.
-
Method Details
-
getEmptyCopy
Tensor[] getEmptyCopy()Generates an empty copy of the underlyingTensorarray.It's the same size and shape as the parameters, but all the values are 0.0.
- Returns:
- A copy of the parameters where all values are 0.0.
-
get
-
set
-
update
Apply gradients to the parameters. Assumes that gradients is the same length as the parameters, and eachTensoris the same size as the corresponding one from the parameters.The gradients are added to the parameters.
-
merge
Merge together an array of gradient arrays. Assumes the first dimension is the number of gradient arrays and the second dimension is the number of parameterTensors.- Parameters:
gradients- An array of gradient update arrays.size- The number of elements of gradients to merge. Allows gradients to have unused elements.- Returns:
- A single
Tensorarray of the summed gradients.
-