jsat.classifiers.neuralnetwork.regularizers
Class Max2NormRegularizer
- java.lang.Object
-
- jsat.classifiers.neuralnetwork.regularizers.Max2NormRegularizer
-
- All Implemented Interfaces:
- java.io.Serializable, WeightRegularizer
public class Max2NormRegularizer extends java.lang.Object implements WeightRegularizer
This regularizer restricts the norm of each neuron's weights to be bounded by a fixed constant, and rescaled when the norm is exceeded.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Max2NormRegularizer(double maxNorm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidapplyRegularization(Matrix W, Vec b)Applies regularization to one matrix, where the rows of the matrix correspond tot he weights associated to one neuron's input.voidapplyRegularization(Matrix W, Vec b, java.util.concurrent.ExecutorService ex)Applies regularization to one matrix, where the rows of the matrix correspond tot he weights associated to one neuron's input.doubleapplyRegularizationToRow(Vec w, double b)Applies the regularization to one row of the weight matrix, where the row corresponds to the weights into one neuron.Max2NormRegularizerclone()doublegetMaxNorm()voidsetMaxNorm(double maxNorm)Sets the maximum allowed 2 norm for a single neuron's weights
-
-
-
Method Detail
-
setMaxNorm
public void setMaxNorm(double maxNorm)
Sets the maximum allowed 2 norm for a single neuron's weights- Parameters:
maxNorm- the maximum norm per neuron's weights
-
getMaxNorm
public double getMaxNorm()
- Returns:
- the maximum allowed 2 norm for a single neuron's weights
-
applyRegularization
public void applyRegularization(Matrix W, Vec b)
Description copied from interface:WeightRegularizerApplies regularization to one matrix, where the rows of the matrix correspond tot he weights associated to one neuron's input. The vector of bias terms must then have the same length as the number of rows in the given matrix.- Specified by:
applyRegularizationin interfaceWeightRegularizer- Parameters:
W- the matrix to apply regularization tob- the vector of bias terms to apply regularization to
-
applyRegularization
public void applyRegularization(Matrix W, Vec b, java.util.concurrent.ExecutorService ex)
Description copied from interface:WeightRegularizerApplies regularization to one matrix, where the rows of the matrix correspond tot he weights associated to one neuron's input. The vector of bias terms must then have the same length as the number of rows in the given matrix.- Specified by:
applyRegularizationin interfaceWeightRegularizer- Parameters:
W- the matrix to apply regularization tob- the vector of bias terms to apply regularization toex- the source of threads for parallel computation
-
applyRegularizationToRow
public double applyRegularizationToRow(Vec w, double b)
Description copied from interface:WeightRegularizerApplies the regularization to one row of the weight matrix, where the row corresponds to the weights into one neuron.- Specified by:
applyRegularizationToRowin interfaceWeightRegularizer- Parameters:
w- the weight row to be altered depending on the regularization methodb- the original bias input to this row- Returns:
- the new bias value, or the same value if no change in the bias has occurred
-
clone
public Max2NormRegularizer clone()
- Specified by:
clonein interfaceWeightRegularizer- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG