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

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

Introduction

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

Prototype

public RVFDataset() 

Source Link

Usage

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

License:Open Source License

@Override
public void train(List<Word> trainSet) {
    RVFDataset<String, String> ds = new RVFDataset<>();
    ds.addAll(WordSet.toStanfordSet(trainSet));
    //unfortunately couldn't find hot to retrain;
    this.classifier = classifier == null ? classifierFactory.trainClassifier(ds) : classifier;
}

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

License:Open Source License

@Override
public void train(List<Word> trainSet) {
    RVFDataset<String, String> ds = new RVFDataset<>();
    ds.addAll(WordSet.toStanfordSet(trainSet));
    //classifierFactory.heldOutSetC(ds, 0.1, new MultiClassAccuracyStats<String>(1), new GoldenSectionLineSearch(true));
    //classifierFactory.crossValidateSetC(ds, 2, new MultiClassAccuracyStats<String>(1), new GoldenSectionLineSearch(true));
    this.classifier = classifier == null ? classifierFactory.trainClassifierBasic(ds) : classifier;
}

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  w w .  ja va  2  s.c  o m*/
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);
}