Package org.encog.ml.data.basic

Examples of org.encog.ml.data.basic.BasicMLData


      
       BufferedMLDataSet buffer = new BufferedMLDataSet(binFile);
       buffer.beginLoad(input.length, ideal.length);
       while(csv.next())
       {
         BasicMLData inputData = new BasicMLData(input.length);
         BasicMLData idealData = new BasicMLData(ideal.length);
        
         // handle input data
         for(int i=0;i<input.length;i++) {
           inputData.setData(i, csv.getDouble(input[i]));
         }
        
         // handle input data
         for(int i=0;i<ideal.length;i++) {
           idealData.setData(i, csv.getDouble(ideal[i]));
         }
        
         // add to dataset
        
           buffer.add(inputData,idealData);
View Full Code Here


  public void testNEATBuffered() {
    BufferedMLDataSet buffer = new BufferedMLDataSet(EGB_FILENAME);
    buffer.beginLoad(2, 1);
    for(int i=0;i<XOR.XOR_INPUT.length;i++) {
      buffer.add(new BasicMLDataPair(
          new BasicMLData(XOR.XOR_INPUT[i]),
          new BasicMLData(XOR.XOR_IDEAL[i])));
    }
    buffer.endLoad();
   
    NEATPopulation pop = new NEATPopulation(2,1,1000);
    pop.setInitialConnectionDensity(1.0);// not required, but speeds training
View Full Code Here

   
    public static boolean verifyXOR(MLRegression network,double tolerance)
    {
      for(int trainingSet=0;trainingSet<XOR.XOR_IDEAL.length;trainingSet++)
      {
        MLData actual = network.compute(new BasicMLData(XOR.XOR_INPUT[trainingSet]));
       
        for(int i=0;i<XOR.XOR_IDEAL[0].length;i++)
        {
          double diff = Math.abs(actual.getData(i)-XOR.XOR_IDEAL[trainingSet][i]);
          if( diff>tolerance )
View Full Code Here

    public static MLDataSet createNoisyXORDataSet(int count) {
      MLDataSet result = new BasicMLDataSet();
      for(int i=0;i<count;i++) {
        for(int j=0;j<4;j++) {
          MLData inputData = new BasicMLData(XOR_INPUT[j]);
          MLData idealData = new BasicMLData(XOR_IDEAL[j]);
          MLDataPair pair = new BasicMLDataPair(inputData,idealData);
          inputData.setData(0, inputData.getData(0)+RangeRandomizer.randomize(-0.1, 0.1));
          inputData.setData(1, inputData.getData(1)+RangeRandomizer.randomize(-0.1, 0.1));
          result.add(pair);
        }
View Full Code Here

public class TestMajorityVoting extends TestCase {

  public void testMajorityVoting() {

    BasicMLData right = new BasicMLData(new double[]{0.0,1.0});
    BasicMLData wrong = new BasicMLData(new double[]{1.0,0.0});

    ArrayList<MLData> outs = new ArrayList<MLData>();
    outs.add(right);
    outs.add(wrong);
    outs.add(right);
    outs.add(right);

    MajorityVoting majorityVotingUnderTest = new MajorityVoting();

    BasicMLData result = (BasicMLData) majorityVotingUnderTest.evaluate(outs);
    TestCase.assertEquals(0.0,result.getData(0));
    TestCase.assertEquals(1.0,result.getData(1));

  }
View Full Code Here

               
        BasicMLDataSet set = new BasicMLDataSet();
       
        for(int i=0;i<DATA.length;i++)
        {
          set.add(new BasicMLData(DATA[i]));
        }

        KMeansClustering kmeans = new KMeansClustering(2,set);
        kmeans.iteration();
        //Assert.assertEquals(37, (int)kmeans.getWCSS());
View Full Code Here

  {
    new File(FILENAME).delete();
    BufferedMLDataSet set = new BufferedMLDataSet(new File(FILENAME));
    set.beginLoad(2, 1);
    for(int i=0;i<XOR.XOR_INPUT.length;i++) {
      BasicMLData input = new BasicMLData(XOR.XOR_INPUT[i]);
      BasicMLData ideal = new BasicMLData(XOR.XOR_IDEAL[i]);
      set.add(input,ideal);
    }
    set.endLoad();
   
    XOR.testXORDataSet(set);
View Full Code Here

  {
    BasicNetwork network = EncogUtility.simpleFeedForward(5,6,0,2,true);
    PruneSelective prune = new PruneSelective(network);
    prune.changeNeuronCount(1, 60);
   
    BasicMLData input = new BasicMLData(5);
    BasicNetwork model = EncogUtility.simpleFeedForward(5,60,0,2,true);
    checkWithModel(model.getStructure().getFlat(),network.getStructure().getFlat());
    model.compute(input);
    network.compute(input);
  }
View Full Code Here

    for (iteration = 0; iteration <= 100; iteration++) {
      train.iteration();
    }

    final MLData data1 = new BasicMLData(
        TestCompetitive.SOM_INPUT[0]);
    final MLData data2 = new BasicMLData(
        TestCompetitive.SOM_INPUT[1]);
   
    int result1 = network.classify(data1);
    int result2 = network.classify(data2);
   
View Full Code Here

        this.network.getDeriv2()[ivar] += temp * der2 + 2.0 * der1
            * der1;
      }
    }

    return new BasicMLData(out);
  }
View Full Code Here

TOP

Related Classes of org.encog.ml.data.basic.BasicMLData

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.