List of usage examples for edu.stanford.nlp.classify LogPrior LogPrior
public LogPrior(double[] C)
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); }