Package com.github.pmerienne.trident.ml.classification

Examples of com.github.pmerienne.trident.ml.classification.PAClassifier


public class PATest extends ClassifierTest {

  @Test
  public void testWithNand() {
    List<Instance<Boolean>> samples = Datasets.generatedNandInstances(100);
    double error = this.eval(new PAClassifier(), samples);
    assertTrue("Error " + error + " is to big!", error < 0.05);
  }
View Full Code Here


    assertTrue("Error " + error + " is to big!", error < 0.05);
  }

  @Test
  public void testWithGaussianData() {
    double error = this.eval(new PAClassifier(), Datasets.generateDataForClassification(1000, 10));
    double error1 = this.eval(new PAClassifier(Type.PA1), Datasets.generateDataForClassification(1000, 10));
    double error2 = this.eval(new PAClassifier(Type.PA2), Datasets.generateDataForClassification(1000, 10));

    assertTrue("Error " + error + " is to big!", error <= 0.05);
    assertTrue("Error " + error + " is to big!", error1 <= 0.05);
    assertTrue("Error " + error + " is to big!", error2 <= 0.05);
  }
View Full Code Here

    assertTrue("Error " + error + " is to big!", error2 <= 0.05);
  }

  @Test
  public void testWithSPAMData() {
    double error = this.eval(new PAClassifier(), Datasets.getSpamSamples());
    double error1 = this.eval(new PAClassifier(Type.PA1), Datasets.getSpamSamples());
    double error2 = this.eval(new PAClassifier(Type.PA2), Datasets.getSpamSamples());
    assertTrue("Error " + error + " is to big!", error <= 0.20);
    assertTrue("Error " + error + " is to big!", error1 <= 0.20);
    assertTrue("Error " + error + " is to big!", error2 <= 0.20);
  }
View Full Code Here

      // Init feature extractor
      TFIDF featuresExtractor = new TFIDF(documents, 10000);

      // Init and train classifier
      PAClassifier classifier = new PAClassifier();
      double[] features;
      for (TextInstance<Boolean> instance : dataset) {
        features = featuresExtractor.extractFeatures(instance.tokens);
        classifier.update(instance.label, features);
      }

      // save them
      save(featuresExtractor, classifier);
    }
View Full Code Here

TOP

Related Classes of com.github.pmerienne.trident.ml.classification.PAClassifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.