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

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


public class PerceptronTest extends ClassifierTest {

  @Test
  public void testWithNand() {
    List<Instance<Boolean>> samples = Datasets.generatedNandInstances(100);
    double error = this.eval(new PerceptronClassifier(), 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 PerceptronClassifier(), Datasets.generateDataForClassification(100, 10));
    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 testWithSPAMData() {
    double error = this.eval(new PerceptronClassifier(), Datasets.getSpamSamples());
    assertTrue("Error " + error + " is to big!", error < 0.05);
  }
View Full Code Here

      // Update evaluation
      predictionStream //
          .persistentAggregate(evaluationStateFactory, new Fields("instance", "prediction"), new AccuracyAggregator<Boolean>(), new Fields("accuracy"));

      // Update model
      predictionStream.partitionPersist(perceptronModelStateFactory, new Fields("instance"), new ClassifierUpdater<Boolean>("perceptron", new PerceptronClassifier()));

      // Classification stream
      toppology.newDRPCStream("predict", localDRPC)
      // convert DRPC args to instance
          .each(new Fields("args"), new DRPCArgsToInstance(), new Fields("instance"))
View Full Code Here

      TridentTopology toppology = new TridentTopology();

      // Training stream
      TridentState perceptronModel = toppology.newStream("nandsamples", new NANDSpout())
      // update classifier
          .partitionPersist(new MemoryMapState.Factory(), new Fields("instance"), new ClassifierUpdater<Boolean>("perceptron", new PerceptronClassifier()));

      // Classification stream
      toppology.newDRPCStream("predict", localDRPC)
      // convert DRPC args to instance
          .each(new Fields("args"), new DRPCArgsToInstance(), new Fields("instance"))
View Full Code Here

TOP

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

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.