Package org.encog.ml.data.basic

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


    g.fillRect(0, 0, 5, 5);
    g.dispose();
   
    Downsample downsample = new SimpleIntensityDownsample();
    ImageNeuralDataSet set = new ImageNeuralDataSet(downsample,true,-1,1);
    BasicMLData ideal = new BasicMLData(1);
    ImageNeuralData input = new ImageNeuralData(image);
    set.add(input,ideal);
    set.downsample(2,2);
    Iterator<MLDataPair> itr = set.iterator();
    MLDataPair pair = (MLDataPair)itr.next();
View Full Code Here


  {
    new File(FILENAME).delete();
    BufferedNeuralDataSet set = new BufferedNeuralDataSet(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

   
    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 int scorePilot()
  {
    LanderSimulator sim = new LanderSimulator();
    while(sim.flying())
    {
      MLData input = new BasicMLData(3);
            input.setData(0, this.fuelStats.normalize(sim.getFuel()));
            input.setData(1, this.fuelStats.normalize(sim.getAltitude()));
            input.setData(2, this.fuelStats.normalize(sim.getVelocity()));
            MLData output = this.network.compute(input);
            double value = output.getData(0);

            boolean thrust;
     
View Full Code Here

    MLData out;

    if (method instanceof MLRegression) {
      out = ((MLRegression) method).compute(data.getInput());
    } else if (method instanceof MLClassification) {
      out = new BasicMLData(1);
      out.setData(0,
          ((MLClassification) method).classify(data.getInput()));

    } else {
      throw new WorkBenchError("Unsupported Machine Learning Method:"
View Full Code Here

          + " inputs, however, the data has " + this.inputCount
          + " inputs.");
    }

    MLData output = null;
    final MLData input = new BasicMLData(method.getInputCount());

    final PrintWriter tw = analystPrepareOutputFile(outputFile);

    resetStatus();
    while (csv.next()) {
      updateStatus(false);
      final LoadedRow row = new LoadedRow(csv, this.idealCount);

      int dataIndex = 0;
      // load the input data
      for (int i = 0; i < this.inputCount; i++) {
        final String str = row.getData()[i];
        final double d = getInputFormat().parse(str);
        input.setData(i, d);
        dataIndex++;
      }

      // do we need to skip the ideal values?
      dataIndex += this.idealCount;
View Full Code Here

    * Construct the cluster row.
    * @param input The input data.
    * @param theRow The CSV row.
    */
  public ClusterRow(final double[] input, final LoadedRow theRow) {
    super(new BasicMLData(input));
    this.row = theRow;
  }
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.winner(data1);
    int result2 = network.winner(data2);
   
View Full Code Here

      if (this.series.getTotalDepth() > 1) {
        inputArray = this.series.process(inputArray);
      }

      if (inputArray != null) {
        final MLData input = new BasicMLData(inputArray);

        // evaluation data
        if ((method instanceof MLClassification)
            && !(method instanceof MLRegression)) {
          // classification only?
          output = new BasicMLData(1);
          output.setData(0,
              ((MLClassification) method).classify(input));
        } else {
          // regression
          output = ((MLRegression) method).compute(input);
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.