Example usage for edu.stanford.nlp.classify LogPrior LogPrior

List of usage examples for edu.stanford.nlp.classify LogPrior LogPrior

Introduction

In this page you can find the example usage for edu.stanford.nlp.classify LogPrior LogPrior.

Prototype

public LogPrior(double[] C) 

Source Link

Document

IMPORTANT NOTE: This constructor allows non-uniform regularization, but it transforms the inputs C (like the machine learning people like) to sigma (like we NLP folks like).

Usage

From source file:gr.aueb.cs.nlp.wordtagger.classifier.SVMWindows64Factory.java

License:Open Source License

/**
 * Builds a sigmoid model to turn the classifier outputs into probabilities.
 *///from w  ww  . j a va 2s. c  om
private LinearClassifier<L, L> fitSigmoid(SVMLightClassifier<L, F> classifier, GeneralDataset<L, F> dataset) {
    RVFDataset<L, L> plattDataset = new RVFDataset<L, L>();
    for (int i = 0; i < dataset.size(); i++) {
        RVFDatum<L, F> d = dataset.getRVFDatum(i);
        Counter<L> scores = classifier.scoresOf((Datum<L, F>) d);
        scores.incrementCount(null);
        plattDataset.add(new RVFDatum<L, L>(scores, d.label()));
    }
    LinearClassifierFactory<L, L> factory = new LinearClassifierFactory<L, L>();
    factory.setPrior(new LogPrior(LogPrior.LogPriorType.NULL));
    return factory.trainClassifier(plattDataset);
}