Package ai.djl.fasttext
Class FtTrainingConfig.Builder
java.lang.Object
ai.djl.fasttext.FtTrainingConfig.Builder
- Enclosing class:
- FtTrainingConfig
A builder to construct a
FtTrainingConfig.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newFtTrainingConfig.optBucket(int bucket) Sets the optional number of buckets.optContextWindow(int contextWindow) Sets the optional size of the context window.optEpoch(int epoch) Sets the optional number of epochs.optLabelPrefix(String labelPrefix) Sets the optional label prefix.optLearningRate(float learningRate) Sets the optional learning rate.optLearningRateUpdateRate(int learningRateUpdateRate) Sets the optional rate of updates for the learning rate.Sets the optional loss function.optMaxCharLength(int maxCharLength) Sets the optional maximum length of char ngram.optMaxNGramLength(int maxNgramLength) Sets the optional maximum length of word ngram.optMinCharLength(int minCharLength) Sets the optional minimum length of char ngram.optMinLabelCount(int minLabelCount) Sets the optional minimal number of label occurrences.optMinWordCount(int minWordCount) Sets the optional minimal number of word occurrences.optNumNegativesSampled(int numNegativesSampled) Sets the optional number of negatives sampled.optSamplingThreshold(float samplingThreshold) Sets the optional sampling threshold.optThreads(int threads) Sets the optional number training threads.optTrainingMode(FtTrainingMode trainingMode) Sets the optionalFtTrainingMode.optWordVecSize(int wordVecSize) Sets the optional size of word vectors.setModelName(String modelName) Sets the name of the model.setOutputDir(Path outputDir) Sets the output directory.
-
Method Details
-
setOutputDir
Sets the output directory.- Parameters:
outputDir- the output directory- Returns:
- this builder
-
setModelName
Sets the name of the model.- Parameters:
modelName- the name of the model- Returns:
- this builder
-
optTrainingMode
Sets the optionalFtTrainingMode.- Parameters:
trainingMode- the optionalFtTrainingMode(defaultFtTrainingMode.SUPERVISED- Returns:
- this builder
-
optEpoch
Sets the optional number of epochs.- Parameters:
epoch- the optional number of epochs (default 5)- Returns:
- this builder
-
optMinWordCount
Sets the optional minimal number of word occurrences.- Parameters:
minWordCount- the optional minimal number of word occurrences (default 1)- Returns:
- this builder
-
optMinLabelCount
Sets the optional minimal number of label occurrences.- Parameters:
minLabelCount- the optional minimal number of label occurrences (default 0)- Returns:
- this builder
-
optMaxNGramLength
Sets the optional maximum length of word ngram.- Parameters:
maxNgramLength- the optional maximum length of word ngram (default 1)- Returns:
- this builder
-
optMinCharLength
Sets the optional minimum length of char ngram.- Parameters:
minCharLength- the optional minimum length of char ngram (default 0)- Returns:
- this builder
-
optMaxCharLength
Sets the optional maximum length of char ngram.- Parameters:
maxCharLength- the optional maximum length of char ngram (default 0)- Returns:
- this builder
-
optBucket
Sets the optional number of buckets.- Parameters:
bucket- the optional number of buckets (default 2000000)- Returns:
- this builder
-
optSamplingThreshold
Sets the optional sampling threshold.- Parameters:
samplingThreshold- the optional sampling threshold (default 0.0001)- Returns:
- this builder
-
optLabelPrefix
Sets the optional label prefix.- Parameters:
labelPrefix- the optional label prefix (default "__lable__")- Returns:
- this builder
-
optLearningRate
Sets the optional learning rate.- Parameters:
learningRate- the optional learning rate (default 0.1)- Returns:
- this builder
-
optLearningRateUpdateRate
Sets the optional rate of updates for the learning rate.- Parameters:
learningRateUpdateRate- the optional rate of updates for the learning rate (default 100)- Returns:
- this builder
-
optWordVecSize
Sets the optional size of word vectors.- Parameters:
wordVecSize- the optional size of word vectors (default 100)- Returns:
- this builder
-
optContextWindow
Sets the optional size of the context window.- Parameters:
contextWindow- the optional size of the context window (default 5)- Returns:
- this builder
-
optNumNegativesSampled
Sets the optional number of negatives sampled.- Parameters:
numNegativesSampled- the optional number of negatives sampled (default 5)- Returns:
- this builder
-
optThreads
Sets the optional number training threads.- Parameters:
threads- the optional number training threads (default 12)- Returns:
- this builder
-
optLoss
Sets the optional loss function.- Parameters:
loss- the optional loss function (defaultFtTrainingConfig.FtLoss.SOFTMAX- Returns:
- this builder
-
build
Builds a newFtTrainingConfig.- Returns:
- the new
FtTrainingConfig
-