Package opennlp.tools.ml.libsvm.doccat

# Class SvmDoccatConfiguration.Builder

java.lang.Object
opennlp.tools.ml.libsvm.doccat.SvmDoccatConfiguration.Builder

Enclosing class:
  `SvmDoccatConfiguration`

public static class SvmDoccatConfiguration.Builder extends Object
A builder for `SvmDoccatConfiguration`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SvmDoccatConfiguration`
  `build()`
  `SvmDoccatConfiguration.Builder`
  `setFeatureSelectionStrategy(FeatureSelectionStrategy strategy)`
  Sets the feature selection strategy.
  `SvmDoccatConfiguration.Builder`
  `setMaxFeatures(int maxFeatures)`
  Sets the maximum number of features to retain after feature selection.
  `SvmDoccatConfiguration.Builder`
  `setScaleFeatures(boolean scaleFeatures)`
  Sets whether feature values should be scaled to the range [`lower`, `upper`].
  `SvmDoccatConfiguration.Builder`
  `setScaleRange(double lower, double upper)`
  Sets the lower and upper bounds of the feature scaling range.
  `SvmDoccatConfiguration.Builder`
  `setSvmConfiguration(de.hhn.mi.configuration.SvmConfiguration svmConfiguration)`
  Sets the underlying SVM configuration.
  `SvmDoccatConfiguration.Builder`
  `setTermWeightingStrategy(TermWeightingStrategy strategy)`
  Sets the term weighting strategy.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Builder

    public Builder()

- ## Method Details

  - ### setSvmConfiguration

    public SvmDoccatConfiguration.Builder setSvmConfiguration(de.hhn.mi.configuration.SvmConfiguration svmConfiguration)
    Sets the underlying SVM configuration.

    Note: Probability estimates must be enabled in the SVM configuration for the categorizer to produce probability distributions over categories.

    Parameters:
      `svmConfiguration` - The SVM configuration. Must not be `null`.
    Returns:
      This builder.

  - ### setTermWeightingStrategy

    public SvmDoccatConfiguration.Builder setTermWeightingStrategy(TermWeightingStrategy strategy)
    Sets the term weighting strategy.
    Parameters:
      `strategy` - The weighting strategy. Must not be `null`. Default: `TermWeightingStrategy.TF_IDF`.
    Returns:
      This builder.

  - ### setFeatureSelectionStrategy

    public SvmDoccatConfiguration.Builder setFeatureSelectionStrategy(FeatureSelectionStrategy strategy)
    Sets the feature selection strategy.
    Parameters:
      `strategy` - The selection strategy. Must not be `null`. Default: `FeatureSelectionStrategy.NONE`.
    Returns:
      This builder.

  - ### setMaxFeatures

    public SvmDoccatConfiguration.Builder setMaxFeatures(int maxFeatures)
    Sets the maximum number of features to retain after feature selection. Only applicable when `FeatureSelectionStrategy` is not `FeatureSelectionStrategy.NONE`.
    Parameters:
      `maxFeatures` - The maximum number of features. A value `<= 0` means all features are retained. Default: `-1`.
    Returns:
      This builder.

  - ### setScaleFeatures

    public SvmDoccatConfiguration.Builder setScaleFeatures(boolean scaleFeatures)
    Sets whether feature values should be scaled to the range [`lower`, `upper`].
    Parameters:
      `scaleFeatures` - `true` to enable feature scaling. Default: `true`.
    Returns:
      This builder.

  - ### setScaleRange

    public SvmDoccatConfiguration.Builder setScaleRange(double lower, double upper)
    Sets the lower and upper bounds of the feature scaling range. Only applicable when `setScaleFeatures(boolean)` is `true`.
    Parameters:
      `lower` - The lower bound. Default: `0.0`.
      `upper` - The upper bound. Must be greater than `lower`. Default: `1.0`.
    Returns:
      This builder.
    Throws:
      `IllegalArgumentException` - if `upper <= lower`.

  - ### build

    public SvmDoccatConfiguration build()
    Returns:
      A fully configured `SvmDoccatConfiguration`.