Package opennlp.tools.depparse
Record Class FeedforwardDependencyTrainer.Settings
java.lang.Object
java.lang.Record
opennlp.tools.depparse.FeedforwardDependencyTrainer.Settings
- Record Components:
embeddingSize- The embedding dimensionality. Must be positive.- The hidden layer width. Must be positive.epochs- The number of passes over the examples. Must be positive.batchSize- The minibatch size. Must be positive.learningRate- The AdaGrad step size. Must be positive.l2- The L2 penalty applied to the dense weights. Must not be negative.dropout- The hidden dropout probability. Must be in[0, 1).wordCutoff- The minimum frequency for a word to get its own embedding. Must not be negative.seed- The random seed making a run reproducible.beamSize- The refinement beam width;FeedforwardDependencyTrainer.refine(opennlp.tools.depparse.FeedforwardDependencyModel, opennlp.tools.util.ObjectStream<opennlp.tools.depparse.DependencySample>, opennlp.tools.util.TrainingParameters)requires at least 2.
- Enclosing class:
FeedforwardDependencyTrainer
static record FeedforwardDependencyTrainer.Settings(int embeddingSize, int hiddenSize, int epochs, int batchSize, double learningRate, double l2, double dropout, int wordCutoff, long seed, int beamSize)
extends Record
The parsed hyperparameters of one training or refinement run.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for thebatchSizerecord component.private final intThe field for thebeamSizerecord component.private final doubleThe field for thedropoutrecord component.private final intThe field for theembeddingSizerecord component.private final intThe field for theepochsrecord component.private final intThe field for thehiddenSizerecord component.private final doubleThe field for thel2record component.private final doubleThe field for thelearningRaterecord component.private final longThe field for theseedrecord component.private final intThe field for thewordCutoffrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionSettings(int embeddingSize, int hiddenSize, int epochs, int batchSize, double learningRate, double l2, double dropout, int wordCutoff, long seed, int beamSize) Validates the hyperparameters. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thebatchSizerecord component.intbeamSize()Returns the value of thebeamSizerecord component.doubledropout()Returns the value of thedropoutrecord component.intReturns the value of theembeddingSizerecord component.intepochs()Returns the value of theepochsrecord component.final booleanIndicates whether some other object is "equal to" this one.(package private) static FeedforwardDependencyTrainer.Settingsfrom(TrainingParameters parameters) Reads the hyperparameters, substituting the defaults for absent keys.final inthashCode()Returns a hash code value for this object.intReturns the value of thehiddenSizerecord component.doublel2()Returns the value of thel2record component.doubleReturns the value of thelearningRaterecord component.longseed()Returns the value of theseedrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thewordCutoffrecord component.
-
Field Details
-
embeddingSize
private final int embeddingSizeThe field for theembeddingSizerecord component. -
epochs
private final int epochsThe field for theepochsrecord component. -
batchSize
private final int batchSizeThe field for thebatchSizerecord component. -
learningRate
private final double learningRateThe field for thelearningRaterecord component. -
l2
private final double l2The field for thel2record component. -
dropout
private final double dropoutThe field for thedropoutrecord component. -
wordCutoff
private final int wordCutoffThe field for thewordCutoffrecord component. -
seed
private final long seedThe field for theseedrecord component. -
beamSize
private final int beamSizeThe field for thebeamSizerecord component.
-
-
Constructor Details
-
Settings
Settings(int embeddingSize, int hiddenSize, int epochs, int batchSize, double learningRate, double l2, double dropout, int wordCutoff, long seed, int beamSize) Validates the hyperparameters.- Throws:
IllegalArgumentException- Thrown if a value is outside its documented range or the smallest network of this shape exceedsResourceLimits.MAX_MATRIX_CELLSfloat values.
-
-
Method Details
-
from
Reads the hyperparameters, substituting the defaults for absent keys.- Parameters:
parameters- The training parameters. Must not benull.- Returns:
- The parsed settings. Never
null. - Throws:
IllegalArgumentException- Thrown if a value is outside its documented range.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
embeddingSize
public int embeddingSize()Returns the value of theembeddingSizerecord component.- Returns:
- the value of the
embeddingSizerecord component
-
epochs
public int epochs()Returns the value of theepochsrecord component.- Returns:
- the value of the
epochsrecord component
-
batchSize
public int batchSize()Returns the value of thebatchSizerecord component.- Returns:
- the value of the
batchSizerecord component
-
learningRate
public double learningRate()Returns the value of thelearningRaterecord component.- Returns:
- the value of the
learningRaterecord component
-
l2
public double l2()Returns the value of thel2record component.- Returns:
- the value of the
l2record component
-
dropout
public double dropout()Returns the value of thedropoutrecord component.- Returns:
- the value of the
dropoutrecord component
-
wordCutoff
public int wordCutoff()Returns the value of thewordCutoffrecord component.- Returns:
- the value of the
wordCutoffrecord component
-
seed
public long seed()Returns the value of theseedrecord component.- Returns:
- the value of the
seedrecord component
-
beamSize
public int beamSize()Returns the value of thebeamSizerecord component.- Returns:
- the value of the
beamSizerecord component
-