Package org.encog.ml.data.basic

Examples of org.encog.ml.data.basic.BasicMLDataSet$BasicMLIterator


  @Override
  public final Object read(final InputStream is) {

    final EncogReadHelper in = new EncogReadHelper(is);
    EncogFileSection section;
    final BasicMLDataSet samples = new BasicMLDataSet();
    Map<String, String> networkParams = null;
    PNNKernelType kernel = null;
    PNNOutputMode outmodel = null;
    int inputCount = 0;
    int outputCount = 0;
    double error = 0;
    double[] sigma = null;

    while ((section = in.readNextSection()) != null) {
      if (section.getSectionName().equals("PNN")
          && section.getSubSectionName().equals("PARAMS")) {
        networkParams = section.parseParams();
      }
      if (section.getSectionName().equals("PNN")
          && section.getSubSectionName().equals("NETWORK")) {
        final Map<String, String> params = section.parseParams();
        inputCount = EncogFileSection.parseInt(params,
            PersistConst.INPUT_COUNT);
        outputCount = EncogFileSection.parseInt(params,
            PersistConst.OUTPUT_COUNT);
        kernel = PersistBasicPNN.stringToKernel(params
            .get(PersistConst.KERNEL));
        outmodel = PersistBasicPNN.stringToOutputMode(params
            .get(PersistBasicPNN.PROPERTY_outputMode));
        error = EncogFileSection
            .parseDouble(params, PersistConst.ERROR);
        sigma = EncogFileSection.parseDoubleArray(params,
            PersistConst.SIGMA);
      }
      if (section.getSectionName().equals("PNN")
          && section.getSubSectionName().equals("SAMPLES")) {
        for (final String line : section.getLines()) {
          final List<String> cols = EncogFileSection
              .splitColumns(line);
          int index = 0;
          final MLData inputData = new BasicMLData(inputCount);
          for (int i = 0; i < inputCount; i++) {
            inputData.setData(i,
                CSVFormat.EG_FORMAT.parse(cols.get(index++)));
          }
          final MLData idealData = new BasicMLData(inputCount);
          for (int i = 0; i < outputCount; i++) {
            idealData.setData(i,
                CSVFormat.EG_FORMAT.parse(cols.get(index++)));
          }
          final MLDataPair pair = new BasicMLDataPair(inputData,
              idealData);
          samples.add(pair);
        }
      }
    }

    final BasicPNN result = new BasicPNN(kernel, outmodel, inputCount,
View Full Code Here


public class TestTrainingContinuation extends TestCase {
  public void testContRPROP()
  {
    BasicNetwork network1 = NetworkUtil.createXORNetworkUntrained();
    BasicNetwork network2 = NetworkUtil.createXORNetworkUntrained();
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    // train network 1, no continue
    ResilientPropagation rprop1 = new ResilientPropagation(network1,trainingData);
    rprop1.iteration();
    rprop1.iteration();
View Full Code Here

 
  public void testContBackprop()
  {
    BasicNetwork network1 = NetworkUtil.createXORNetworkUntrained();
    BasicNetwork network2 = NetworkUtil.createXORNetworkUntrained();
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    // train network 1, no continue
    Backpropagation rprop1 = new Backpropagation(network1,trainingData,0.4,0.4);
    rprop1.iteration();
    rprop1.iteration();
View Full Code Here

    BasicNetwork network2 = (BasicNetwork)network1.clone();
    BasicNetwork network3 = (BasicNetwork)network1.clone();
    network2.setBiasActivation(-1);
    network3.setBiasActivation(0.5);
   
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    MLTrain rprop1 = new ResilientPropagation(network1, trainingData);
    MLTrain rprop2 = new ResilientPropagation(network2, trainingData);
    MLTrain rprop3 = new ResilientPropagation(network3, trainingData);
View Full Code Here

public class TrainComplete extends TestCase {
 
  public void testCompleteTrain()
  {
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    BasicNetwork network = EncogUtility.simpleFeedForward(2, 5, 7, 1, true);
    Randomizer randomizer = new ConsistentRandomizer(-1, 1, 19);
    //randomizer.randomize(network);
    System.out.println(network.dumpWeights());
View Full Code Here

*/
public class EvaluateNuguyenWidrow {

   public static void main( String[] args ) {
  
     MLDataSet trainingData1 = new BasicMLDataSet( XOR.XOR_INPUT, XOR.XOR_IDEAL );
     MLDataSet trainingData2 = new BasicMLDataSet( XOR.XOR_INPUT, XOR.XOR_IDEAL );
     MLDataSet trainingData3 = new BasicMLDataSet( XOR.XOR_INPUT, XOR.XOR_IDEAL );
      
       for ( int i = 0; i < 1; i++ ) {
          

          
View Full Code Here

 
  @Test
  public void testRPROP() throws Throwable
  {
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    BasicNetwork network = NetworkUtil.createXORNetworkUntrained();
    MLTrain rprop = new ResilientPropagation(network, trainingData);
    NetworkUtil.testTraining(rprop,0.03);
  }
View Full Code Here

  }
 
  @Test
  public void testLMA() throws Throwable
  {
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    BasicNetwork network = NetworkUtil.createXORNetworkUntrained();
    MLTrain rprop = new LevenbergMarquardtTraining(network, trainingData);
    NetworkUtil.testTraining(rprop,0.03);
  }
View Full Code Here

  }
 
  @Test
  public void testBPROP() throws Throwable
  {
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    BasicNetwork network = NetworkUtil.createXORNetworkUntrained();

    MLTrain bprop = new Backpropagation(network, trainingData, 0.7, 0.9);
    NetworkUtil.testTraining(bprop,0.01);
View Full Code Here

  }
 
  @Test
  public void testManhattan() throws Throwable
  {
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    BasicNetwork network = NetworkUtil.createXORNetworkUntrained();
    MLTrain bprop = new ManhattanPropagation(network, trainingData, 0.01);
    NetworkUtil.testTraining(bprop,0.01);
  }
View Full Code Here

TOP

Related Classes of org.encog.ml.data.basic.BasicMLDataSet$BasicMLIterator

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.