Package org.encog.ml.data

Examples of org.encog.ml.data.MLData


      final double newWeight = temp + ((i - this.center))
          * stepSize[row];

      this.network.getFlat().getWeights()[weight] = newWeight;

      final MLData output = this.network.compute(inputData);
      points[i] = output.getData(outputNeuron);     
    }

    double result = 0.0;
    for (int i = 0; i < this.dCoeff.length; i++) {
      result += this.dCoeff[i] * points[i];
 
View Full Code Here


    final int totalWindowSize = this.inputWindow + this.predictWindow;
    final int stopPoint = data.length - totalWindowSize;

    for (int i = 0; i < stopPoint; i++) {
      final MLData inputData
        = new BasicMLData(this.inputWindow);
      final MLData idealData
        = new BasicMLData(this.predictWindow);

      int index = i;

      // handle input window
      for (int j = 0; j < this.inputWindow; j++) {
        inputData.setData(j, data[index++]);
      }

      // 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);
View Full Code Here

        int totalWindowSize = inputWindow + predictWindow;
        int stopPoint = data.length - totalWindowSize;

        for (int i = 0; i < stopPoint; i++)
        {
            MLData inputData = new BasicMLData(inputWindow);
            MLData idealData = new BasicMLData(predictWindow);

            int index = i;

            // handle input window
            for (int j = 0; j < inputWindow; j++)
            {
                inputData.setData(j, data[index++]);
            }

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

            pair = new BasicMLDataPair(inputData, idealData);
        }
        return pair;
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public double distance(MLData d)
  {
    MLData diff = value.minus(d);
    double sum = 0.;
   
    for (int i = 0; i < diff.size(); i++)
      sum += diff.getData(i) * diff.getData(i);
 
    return Math.sqrt(sum);
  }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public double distance(MLDataPair d)
  {
    MLData diff = value.minus(d.getInput());
    double sum = 0.;
   
    for (int i = 0; i < diff.size(); i++)
      sum += diff.getData(i) * diff.getData(i);
 
    return Math.sqrt(sum);
  }
View Full Code Here

  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);
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public int classify(final MLData input) {
    final MLData output = compute(input);
    return EngineArray.maxIndex(output.getData());
  }
View Full Code Here

   */
  @Override
  public MLData compute(final MLData input) {

    // Allocate result
    final MLData result = new BasicMLData(this.outputLayer.size());

    // Copy the input
    for (int i = 0; i < input.size(); i++) {
      this.inputLayer.setActivation(i, input.getData(i));
    }

    // Request calculation of outputs
    for (int i = 0; i < this.outputLayer.size(); i++) {
      final FreeformNeuron outputNeuron = this.outputLayer.getNeurons()
          .get(i);
      outputNeuron.performCalculation();
      result.setData(i, outputNeuron.getActivation());
    }

    updateContext();

    return result;
View Full Code Here

    while (csv.next() && !shouldStop()) {
      updateStatus(true);
      final double[] inputArray = AnalystNormalizeCSV.extractFields(
          analyst, this.analystHeaders, csv, outputLength, true);
      final MLData input = new BasicMLData(inputArray);
      this.data.add(new BasicMLDataPair(input));

      recordCount++;
    }
    setRecordCount(recordCount);
View Full Code Here

    }

    double worstDistance = Double.NEGATIVE_INFINITY;

    for (final MLDataPair pair : this.training) {
      final MLData out = this.network.computeInstar(pair.getInput());

      // determine winner
      final int winner = EngineArray.indexOfLargest(out.getData());

      // calculate the distance
      double distance = 0;
      for (int i = 0; i < pair.getInput().size(); i++) {
        final double diff = pair.getInput().getData(i)
View Full Code Here

TOP

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

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.