title: How to use encog AI for 3D dataset
body: <p>I have <code>dataset</code> from <code>accelerometer</code> that consist of 3 vectors <code>(x, y, z)</code>
  The issue is that examples on Encog library are for <code>XOR</code> problem and use 2 dimension, and <code>MLData</code> accept only one dimension - double[].</p>
  
  <p>Can anyone help me in explain on <code>3D dataset</code> or
  to point me any other library where is possible to utilize 3D dataset?</p>
  
  <p><strong>EDITED</strong></p>
  
  <p>OK what I did to make it work is</p>
  
  <pre><code>public float compareTwoSequences(HashMap&lt;Integer,List&lt;Float&gt;&gt; base,
                                            HashMap&lt;Integer,List&lt;Float&gt;&gt; compare){
      Log.i("NN alg", "comparing two Sequences");
  
      List&lt;Float&gt; baseX = base.get(SensorData.X_axis);
      List&lt;Float&gt; baseY = base.get(SensorData.Y_axis);
      List&lt;Float&gt; baseZ = base.get(SensorData.Z_axis);
      List&lt;Float&gt; compareX = compare.get(SensorData.X_axis);
      List&lt;Float&gt; compareY = compare.get(SensorData.Y_axis);
      List&lt;Float&gt; compareZ = compare.get(SensorData.Z_axis);
  
      int baseSize = baseX.size();
      int compSize = compareX.size();
      int minSize = Math.min(baseSize, compSize);
  
      double[][] dataSet = new double[6][minSize];
      double[][] testSet = new double[3][minSize];
      double[][] ideal = new double[][]{
              {2.0},
              {2.0},
              {2.0},
              {0.0},
              {0.0},
              {0.0}
      };
      double[][] idealTest = new double[][]{
              {1.0},
              {1.0},
              {1.0}
      };
  
      Iterator&lt;Float&gt; xIter = baseX.iterator();
      Iterator&lt;Float&gt; yIter = baseY.iterator();
      Iterator&lt;Float&gt; zIter = baseZ.iterator();
      Iterator&lt;Float&gt; xIter1 = compareX.iterator();
      Iterator&lt;Float&gt; yIter1 = compareY.iterator();
      Iterator&lt;Float&gt; zIter1 = compareZ.iterator();
      for(int i = 0; i &lt; minSize; i++){
          testSet[0][i] = dataSet[0][i] = xIter.next();
          testSet[1][i] = dataSet[1][i] = yIter.next();
          testSet[2][i] = dataSet[2][i] = zIter.next();
          dataSet[3][i] = xIter1.next();
          dataSet[4][i] = yIter1.next();
          dataSet[5][i] = zIter1.next();
      }
  
  
      NeuralDataSet trainingSet = new BasicNeuralDataSet(dataSet,ideal);
  
      network = new BasicNetwork();
      network.addLayer(new BasicLayer(null, false, baseSize));
      network.addLayer(new BasicLayer(new ActivationTANH(), true, 7));
      network.addLayer(new BasicLayer(new ActivationTANH(), true, 7));
      network.addLayer(new BasicLayer(new ActivationLinear(), false, 1));
      network.getStructure().finalizeStructure();
      network.reset();
  
      final Propagation train = new ResilientPropagation(network, trainingSet);
  
  
  
      int epochsCount = 100;
          for(int epoch = 1; epoch &gt; epochsCount; epoch++ ){
              train.iteration();
          }
          Log.i("alg NN","Training error: "+train.getError()*100.0);
          train.finishTraining();
  
          int i=0;
          double error = 0.0;
          while(i&lt;6){
              MLData input = new BasicMLData(dataSet[i]);
              MLData output = network.compute(input);
              if(i&lt;3){
                  error += Math.abs(output.getData(0));
              }
              Log.i("alg NN","Classification for i:"+i+" "+output.getData(0)+ " ideal "+ideal[i][0]);
              i++;
          }
  
          error = error/3.0*100.0;
          Log.i("alg NN","Final error is: "+error);
          return (float)(error);
  }
  </code></pre>
  
  <p>Anyway I will try now to calibrate network, because the results are bad - like the corresctess is under 50%, where by DTW algorithm is about 80%-90%.</p>
  
  <p>Basicaly I did</p>
  
  <pre><code>input[][]=new double[][]{
  {1,2,3,4,5,6,7,8,9}, // x Axis - first gesture
  {1,2,3,4,5,6,7,8,9}, // y Axis - first gesture
  {1,2,3,4,5,6,7,8,9}, // z Axis - first gesture
  {1,2,3,4,5,6,7,8,9}, // x Axis - second gesture 
  {1,2,3,4,5,6,7,8,9}, // y Axis - second gesture 
  {1,2,3,4,5,6,7,8,9}, // z Axis - second gesture 
  }
  </code></pre>