com.wcohen.ss
Class Mixture

java.lang.Object
  extended by com.wcohen.ss.AbstractStringDistance
      extended by com.wcohen.ss.AbstractTokenizedStringDistance
          extended by com.wcohen.ss.AbstractStatisticalTokenDistance
              extended by com.wcohen.ss.Mixture
All Implemented Interfaces:
StringDistance, StringDistanceLearner

public class Mixture
extends AbstractStatisticalTokenDistance

Mixture-based distance metric.


Field Summary
 
Fields inherited from class com.wcohen.ss.AbstractStatisticalTokenDistance
collectionSize, documentFrequency, totalTokenCount
 
Fields inherited from class com.wcohen.ss.AbstractTokenizedStringDistance
tokenizer
 
Constructor Summary
Mixture()
           
Mixture(Tokenizer tokenizer)
           
 
Method Summary
 java.lang.String explainScore(StringWrapper s, StringWrapper t)
          Explain how the distance was computed.
static void main(java.lang.String[] argv)
           
 double score(StringWrapper s, StringWrapper t)
          Distance is argmax_lambda prod_{w in s} lambda Pr(w|t) * (1-lambda) Pr(w|background).
 java.lang.String toString()
           
 
Methods inherited from class com.wcohen.ss.AbstractStatisticalTokenDistance
checkTrainingHasHappened, getDocumentFrequency, train
 
Methods inherited from class com.wcohen.ss.AbstractTokenizedStringDistance
asBagOfTokens, prepare, setStringWrapperPool
 
Methods inherited from class com.wcohen.ss.AbstractStringDistance
addExample, doMain, explainScore, getDistance, hasNextQuery, nextQuery, prepare, prepare, score, setDistanceInstancePool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Mixture

public Mixture(Tokenizer tokenizer)

Mixture

public Mixture()
Method Detail

score

public double score(StringWrapper s,
                    StringWrapper t)
Distance is argmax_lambda prod_{w in s} lambda Pr(w|t) * (1-lambda) Pr(w|background). This is computed with E/M.

Specified by:
score in interface StringDistance
Specified by:
score in class AbstractStringDistance

explainScore

public java.lang.String explainScore(StringWrapper s,
                                     StringWrapper t)
Explain how the distance was computed. In the output, the tokens in S and T are listed, and the common tokens are marked with an asterisk.

Specified by:
explainScore in interface StringDistance
Specified by:
explainScore in class AbstractStringDistance

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] argv)