Examples of MLDataSet


Examples of org.encog.ml.data.MLDataSet

        //Degenerate training data only provides outputs as 1 or 0 (averaging over all outputs for a given set of inputs would produce something approaching the smooth training data).
        //Smooth training data provides true values for the provided input dimensions.
        create2DSmoothTainingDataGit();

        //Create the training set and train.
        MLDataSet trainingSet = new BasicMLDataSet(INPUT, IDEAL);
        MLTrain train = new SVDTraining(network, trainingSet);

        //SVD is a single step solve
        int epoch = 1;
        do
View Full Code Here

Examples of org.encog.ml.data.MLDataSet

    return network;
  }
 
  public static MLDataSet generateTraining()
  {
    final MLDataSet training = RandomTrainingFactory.generate(1000,50000,
        INPUT_COUNT, OUTPUT_COUNT, -1, 1);
    return training;
  }
View Full Code Here

Examples of org.encog.ml.data.MLDataSet

  }
 
  public static void main(String args[])
  {
    BasicNetwork network = generateNetwork();
    MLDataSet data = generateTraining();
   
    double rprop = evaluateRPROP(network,data);
    double mprop = evaluateMPROP(network,data);
    double factor = rprop/mprop;
    System.out.println("Factor improvement:" + factor);
View Full Code Here

Examples of org.encog.ml.data.MLDataSet

        "O   O",
        " OOO "  } };
 
  public static MLDataSet generateTraining()
  {
    MLDataSet result = new BasicMLDataSet();
    for(int i=0;i<DIGITS.length;i++)
    {     
      BasicMLData ideal = new BasicMLData(DIGITS.length);
     
      // setup input
      MLData input = image2data(DIGITS[i]);
     
      // setup ideal
      for(int j=0;j<DIGITS.length;j++)
      {
        if( j==i )
          ideal.setData(j,1);
        else
          ideal.setData(j,-1);
      }
     
      // add training element
      result.add(input,ideal);
    }
    return result;
  }
View Full Code Here

Examples of org.encog.ml.data.MLDataSet

    pattern.setInputNeurons(inputNeurons);
    pattern.setOutputNeurons(outputNeurons);
    BasicNetwork network = (BasicNetwork)pattern.generate();
   
    // train it
    MLDataSet training = generateTraining();
    MLTrain train = new TrainAdaline(network,training,0.01);
   
    int epoch = 1;
    do {
      train.iteration();
View Full Code Here

Examples of org.encog.ml.data.MLDataSet

    network.addLayer(new BasicLayer(new ActivationSigmoid(), false,
        output[0].length));
    network.getStructure().finalizeStructure();
    network.reset();

    MLDataSet trainingSet = new BasicMLDataSet(input, output);

    // train the neural network
    MLTrain train = new Backpropagation(network, trainingSet, 0.7, 0.7);

    Stopwatch sw = new Stopwatch();
View Full Code Here

Examples of org.encog.ml.data.MLDataSet

   * @param idealSize The ideal size, 0 for unsupervised.
   * @return A NeuralDataSet that holds the contents of the CSV file.
   */
  public static MLDataSet loadCSVTOMemory(CSVFormat format,
      String filename, boolean headers, int inputSize, int idealSize) {
    MLDataSet result = new BasicMLDataSet();
    ReadCSV csv = new ReadCSV(filename, headers, format);
    while (csv.next()) {
      MLData input = null;
      MLData ideal = null;
      int index = 0;

      input = new BasicMLData(inputSize);
      for (int i = 0; i < inputSize; i++) {
        double d = csv.getDouble(index++);
        input.setData(i, d);
      }

      if (idealSize > 0) {
        ideal = new BasicMLData(idealSize);
        for (int i = 0; i < idealSize; i++) {
          double d = csv.getDouble(index++);
          ideal.setData(i, d);
        }
      }

      MLDataPair pair = new BasicMLDataPair(input, ideal);
      result.add(pair);
    }

    return result;
  }
View Full Code Here

Examples of org.encog.ml.data.MLDataSet

  }

  public void run() {
    normalizeSunspots(0.1, 0.9);
    BasicNetwork network = createNetwork();
    MLDataSet training = generateTraining();
    train(network, training);
    predict(network);

  }
View Full Code Here

Examples of org.encog.ml.data.MLDataSet

  public static double XOR_IDEAL[][] = { { 0.0 }, { 1.0 }, { 1.0 }, { 0.0 } };

 
  public static void main(String[] args)
  {
    MLDataSet trainingSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);
    BasicNetwork network = EncogUtility.simpleFeedForward(2, 4, 0, 1, false);
    ResilientPropagation train = new ResilientPropagation(network, trainingSet);
    train.addStrategy(new RequiredImprovementStrategy(5));
   
    System.out.println("Perform initial train.");
View Full Code Here

Examples of org.encog.ml.data.MLDataSet

    // first, create the machine learning method
    MLMethodFactory methodFactory = new MLMethodFactory();   
    MLMethod method = methodFactory.create(methodName, methodArchitecture, 2, outputNeurons);
   
    // second, create the data set   
    MLDataSet dataSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);
   
    // third, create the trainer
    MLTrainFactory trainFactory = new MLTrainFactory()
    MLTrain train = trainFactory.create(method,dataSet,trainerName,trainerArgs);       
    // reset if improve is less than 1% over 5 cycles
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.