nodes.nlp

StupidBackoffEstimator

case class StupidBackoffEstimator[T](unigramCounts: Map[T, Int], alpha: Double = 0.4)(implicit evidence$3: ClassTag[T]) extends Estimator[(NGram[T], Int), (NGram[T], Double)] with Product with Serializable

Estimates a Stupid Backoff ngram language model, which was introduced in the following paper:

Brants, Thorsten, et al. "Large language models in machine translation." 2007.

The results are scores indicating likeliness of each ngram, but they are not normalized probabilities. The score for an n-gram is defined recursively:

S(w_i | w_{i - n + 1}{i - 1}) := if numerator > 0: freq(w_{i - n + 1}i) / freq(w_{i - n + 1}{i - 1}) otherwise: \alpha * S(w_i | w_{i - n + 2}{i - 1})

S(w_i) := freq(w_i) / N, where N is the total number of tokens in training corpus.

unigramCounts

the pre-computed unigram counts of the training corpus

alpha

hyperparameter that gets multiplied once per backoff

Linear Supertypes
Product, Equals, Estimator[(NGram[T], Int), (NGram[T], Double)], EstimatorNode, Serializable, Serializable, Node, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. StupidBackoffEstimator
  2. Product
  3. Equals
  4. Estimator
  5. EstimatorNode
  6. Serializable
  7. Serializable
  8. Node
  9. AnyRef
  10. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new StupidBackoffEstimator(unigramCounts: Map[T, Int], alpha: Double = 0.4)(implicit arg0: ClassTag[T])

    unigramCounts

    the pre-computed unigram counts of the training corpus

    alpha

    hyperparameter that gets multiplied once per backoff

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. val alpha: Double

    hyperparameter that gets multiplied once per backoff

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def fit(data: RDD[(NGram[T], Int)]): StupidBackoffModel[T]

    An estimator has a fit method which emits a Transformer.

    An estimator has a fit method which emits a Transformer.

    data

    Input data.

    returns

    A Transformer which can be called on new data.

    Definition Classes
    StupidBackoffEstimatorEstimator
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. def label: String

    Definition Classes
    Node
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  19. val unigramCounts: Map[T, Int]

    the pre-computed unigram counts of the training corpus

  20. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. def withData(data: RDD[(NGram[T], Int)]): Pipeline[(NGram[T], Int), (NGram[T], Double)]

    Constructs a pipeline from a single estimator and training data.

    Constructs a pipeline from a single estimator and training data. Equivalent to Pipeline() andThen (estimator, data)

    data

    The training data

    Definition Classes
    Estimator

Inherited from Product

Inherited from Equals

Inherited from Estimator[(NGram[T], Int), (NGram[T], Double)]

Inherited from EstimatorNode

Inherited from Serializable

Inherited from Serializable

Inherited from Node

Inherited from AnyRef

Inherited from Any

Ungrouped