Package org.encog.ml.data

Examples of org.encog.ml.data.MLDataPair


                             
        int i = 1;
        for(MLCluster cluster: kmeans.getClusters())
        {
          MLDataSet ds = cluster.createDataSet();
            MLDataPair pair = BasicMLDataPair.createPair(ds.getInputSize(), ds.getIdealSize());
            for(int j=0;j<ds.getRecordCount();j++)
            {
              ds.getRecord(j, pair);
              for(j=0;j<pair.getInputArray().length;j++) {
                if(i==1) {
                  Assert.assertTrue(pair.getInputArray()[j]>10);
                } else {
                  Assert.assertTrue(pair.getInputArray()[j]<10);
                }
              }
             
            }
           
View Full Code Here


  public void addRow(final int row) {
    final int idealSize = this.data.getIdealSize();
    final int inputSize = this.data.getInputSize();
    final MLData idealData = new BasicMLData(idealSize);
    final MLData inputData = new BasicMLData(inputSize);
    final MLDataPair pair = new BasicMLDataPair(inputData,
        idealData);
    if (row == -1) {
      this.data.getData().add(pair);
    } else {
      this.data.getData().add(row, pair);
View Full Code Here

      // handle predict window
      for (int j = 0; j < this.predictWindow; j++) {
        idealData.setData(j, data[index++]);
      }

      final MLDataPair pair = new BasicMLDataPair(inputData,
          idealData);
      result.add(pair);
    }

    return result;
View Full Code Here

   */
  public final double calculateError(final MLDataSet data) {
    final ErrorCalculation errorCalculation = new ErrorCalculation();

    final double[] actual = new double[this.outputCount];
    final MLDataPair pair = BasicMLDataPair.createPair(data.getInputSize(),
        data.getIdealSize());

    for (int i = 0; i < data.getRecordCount(); i++) {
      data.getRecord(i, pair);
      compute(pair.getInputArray(), actual);
      errorCalculation.updateError(actual, pair.getIdealArray(), pair.getSignificance());
    }
    return errorCalculation.calculate();
  }
View Full Code Here

  private double getMaxValue(final int index) {
    double result = Double.MIN_VALUE;
    final long count = this.set.getRecordCount();

    for (int i = 0; i < count; i++) {
      final MLDataPair pair = BasicMLDataPair.createPair(
          this.set.getInputSize(), this.set.getIdealSize());
      this.set.getRecord(index, pair);
      result = Math.max(result, pair.getInputArray()[index]);
    }
    return result;
  }
View Full Code Here

   * @return The minimum value.
   */
  private double getMinValue(final int index) {
    double result = Double.MAX_VALUE;
    final long count = this.set.getRecordCount();
    final MLDataPair pair = BasicMLDataPair.createPair(
        this.set.getInputSize(), this.set.getIdealSize());

    for (int i = 0; i < count; i++) {
      this.set.getRecord(index, pair);
      result = Math.min(result, pair.getInputArray()[index]);
    }
    return result;
  }
View Full Code Here

    // Display the cluster
    int i = 1;
    for (final MLCluster cluster : kmeans.getClusters()) {
      System.out.println("*** Cluster " + (i++) + " ***");
      final MLDataSet ds = cluster.createDataSet();
      final MLDataPair pair = BasicMLDataPair.createPair(
          ds.getInputSize(), ds.getIdealSize());
      for (int j = 0; j < ds.getRecordCount(); j++) {
        ds.getRecord(j, pair);
        System.out.println(Arrays.toString(pair.getInputArray()));

      }
    }
  }
View Full Code Here

          double d = csv.getDouble(index++);
          ideal.setData(i, d);
        }
      }

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

    return result;
  }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public final MLDataPair next() {
    if (hasNext()) {
      final MLDataPair pair = BasicMLDataPair.createPair(
          this.owner.getInputSize(), this.owner.getIdealSize());
      this.owner.getRecord(this.currentIndex++, pair);
      return pair;
    } else {
      return null;
View Full Code Here

    if (!hasNext()) {
      return null;
    }

    final MLDataPair pair = BasicMLDataPair.createPair(
        this.data.getInputSize(), this.data.getIdealSize());
    this.data.getRecord(this.current++, pair);
    return pair;
  }
View Full Code Here

TOP

Related Classes of org.encog.ml.data.MLDataPair

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.