Class FtTrainingConfig.Builder

java.lang.Object
ai.djl.fasttext.FtTrainingConfig.Builder
Enclosing class:
FtTrainingConfig

public static final class FtTrainingConfig.Builder extends Object
A builder to construct a FtTrainingConfig.
  • Method Details

    • setOutputDir

      public FtTrainingConfig.Builder setOutputDir(Path outputDir)
      Sets the output directory.
      Parameters:
      outputDir - the output directory
      Returns:
      this builder
    • setModelName

      public FtTrainingConfig.Builder setModelName(String modelName)
      Sets the name of the model.
      Parameters:
      modelName - the name of the model
      Returns:
      this builder
    • optTrainingMode

      public FtTrainingConfig.Builder optTrainingMode(FtTrainingMode trainingMode)
      Sets the optional FtTrainingMode.
      Parameters:
      trainingMode - the optional FtTrainingMode (default FtTrainingMode.SUPERVISED
      Returns:
      this builder
    • optEpoch

      public FtTrainingConfig.Builder optEpoch(int epoch)
      Sets the optional number of epochs.
      Parameters:
      epoch - the optional number of epochs (default 5)
      Returns:
      this builder
    • optMinWordCount

      public FtTrainingConfig.Builder optMinWordCount(int minWordCount)
      Sets the optional minimal number of word occurrences.
      Parameters:
      minWordCount - the optional minimal number of word occurrences (default 1)
      Returns:
      this builder
    • optMinLabelCount

      public FtTrainingConfig.Builder optMinLabelCount(int minLabelCount)
      Sets the optional minimal number of label occurrences.
      Parameters:
      minLabelCount - the optional minimal number of label occurrences (default 0)
      Returns:
      this builder
    • optMaxNGramLength

      public FtTrainingConfig.Builder optMaxNGramLength(int maxNgramLength)
      Sets the optional maximum length of word ngram.
      Parameters:
      maxNgramLength - the optional maximum length of word ngram (default 1)
      Returns:
      this builder
    • optMinCharLength

      public FtTrainingConfig.Builder optMinCharLength(int minCharLength)
      Sets the optional minimum length of char ngram.
      Parameters:
      minCharLength - the optional minimum length of char ngram (default 0)
      Returns:
      this builder
    • optMaxCharLength

      public FtTrainingConfig.Builder optMaxCharLength(int maxCharLength)
      Sets the optional maximum length of char ngram.
      Parameters:
      maxCharLength - the optional maximum length of char ngram (default 0)
      Returns:
      this builder
    • optBucket

      public FtTrainingConfig.Builder optBucket(int bucket)
      Sets the optional number of buckets.
      Parameters:
      bucket - the optional number of buckets (default 2000000)
      Returns:
      this builder
    • optSamplingThreshold

      public FtTrainingConfig.Builder optSamplingThreshold(float samplingThreshold)
      Sets the optional sampling threshold.
      Parameters:
      samplingThreshold - the optional sampling threshold (default 0.0001)
      Returns:
      this builder
    • optLabelPrefix

      public FtTrainingConfig.Builder optLabelPrefix(String labelPrefix)
      Sets the optional label prefix.
      Parameters:
      labelPrefix - the optional label prefix (default "__lable__")
      Returns:
      this builder
    • optLearningRate

      public FtTrainingConfig.Builder optLearningRate(float learningRate)
      Sets the optional learning rate.
      Parameters:
      learningRate - the optional learning rate (default 0.1)
      Returns:
      this builder
    • optLearningRateUpdateRate

      public FtTrainingConfig.Builder optLearningRateUpdateRate(int learningRateUpdateRate)
      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

      public FtTrainingConfig.Builder optWordVecSize(int wordVecSize)
      Sets the optional size of word vectors.
      Parameters:
      wordVecSize - the optional size of word vectors (default 100)
      Returns:
      this builder
    • optContextWindow

      public FtTrainingConfig.Builder optContextWindow(int contextWindow)
      Sets the optional size of the context window.
      Parameters:
      contextWindow - the optional size of the context window (default 5)
      Returns:
      this builder
    • optNumNegativesSampled

      public FtTrainingConfig.Builder optNumNegativesSampled(int numNegativesSampled)
      Sets the optional number of negatives sampled.
      Parameters:
      numNegativesSampled - the optional number of negatives sampled (default 5)
      Returns:
      this builder
    • optThreads

      public FtTrainingConfig.Builder optThreads(int threads)
      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 (default FtTrainingConfig.FtLoss.SOFTMAX
      Returns:
      this builder
    • build

      public FtTrainingConfig build()
      Builds a new FtTrainingConfig.
      Returns:
      the new FtTrainingConfig