title: Correct way to remove noise from a time series using DNN
body: <p>I am working with some fixed length time series data . This data is of the form headers #0-->time series trace#0-->header#1-->time series trace #1 -->..->header#P-->time series trace #P. Through the use of some Apis meant to deal with such data I was finally able to convert the data into an INDArray of shape [P, length of time series] . If my aim is to remove noise from the data, what should I be using as my DNN ?
  I have worked with stacked Denoised Autoencoders so far, but am not sure if the way I have implemented it is correct.</p>
  
  <pre><code>  INDArray sinput=Nd4j.zeros(n1,n2);           //creating a 2D matrix of rows=samples, columns=traceNumbers
  
  
      float[] data = new float[n1];           //for the length of n1 samples
  
  
      for(int j=0;j&lt;n2;j++){                  //for each trace
          input.read(data);
  
          for(int k=0;k&lt; n1;k++){
              System.out.println("reading "+k+","+j+" value: "+data[k] );
              sinput.putScalar(new int[]{k,j},data[k]);
  
  
          }
      }
  
  
  
      Activation act=Activation.RELU;
      LearningRatePolicy lrPol=LearningRatePolicy.None;
      MultiLayerConfiguration configuration= new NeuralNetConfiguration.Builder()
              .seed(13)
              .iterations(20000)
              .learningRate(0.003)
              .learningRateDecayPolicy(lrPol)
              .lrPolicyDecayRate(1e-5)
              .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
              .l1(1e-5)
              .regularization(true)
              .l2(1e-3)
              .list()
  
              .layer(0,new AutoEncoder.Builder().nIn(n2).nOut(FIRST_HIDDEN_LAYER_WIDTH).activation(act).corruptionLevel(0.3).weightInit(WeightInit.XAVIER).build())
              .layer(1,new AutoEncoder.Builder().nIn(FIRST_HIDDEN_LAYER_WIDTH).nOut(SECOND_HIDDEN_LAYER_WIDTH).activation(act).weightInit(WeightInit.XAVIER).build())
              .layer(2,new AutoEncoder.Builder().nIn(SECOND_HIDDEN_LAYER_WIDTH).nOut(THIRD_HIDDEN_LAYER_WIDTH).activation(act).weightInit(WeightInit.XAVIER).build())
              .layer(3,new AutoEncoder.Builder().nIn(THIRD_HIDDEN_LAYER_WIDTH).nOut(FOURTH_HIDDEN_LAYER_WIDTH).activation(act).weightInit(WeightInit.XAVIER).build())
  
  
  
              .layer(4,new AutoEncoder.Builder().nIn(FOURTH_HIDDEN_LAYER_WIDTH).nOut(THIRD_HIDDEN_LAYER_WIDTH).activation(act).weightInit(WeightInit.XAVIER).corruptionLevel(0.3).build())
              .layer(5,new AutoEncoder.Builder().nIn(THIRD_HIDDEN_LAYER_WIDTH).nOut(SECOND_HIDDEN_LAYER_WIDTH).activation(act).weightInit(WeightInit.XAVIER).corruptionLevel(0.3).build())
              .layer(6,new AutoEncoder.Builder().nIn(SECOND_HIDDEN_LAYER_WIDTH).nOut(FIRST_HIDDEN_LAYER_WIDTH).activation(act).weightInit(WeightInit.XAVIER).corruptionLevel(0.3).build())
              .layer(7,new AutoEncoder.Builder().nIn(FIRST_HIDDEN_LAYER_WIDTH).nOut(n2).activation(act).weightInit(WeightInit.XAVIER).corruptionLevel(0.3).build())
              //  .layer(1,new AutoEncoder.Builder().nIn(SECOND_HIDDEN_LAYER_WIDTH).nOut(SECOND_HIDDEN_LAYER_WIDTH).activation(Activation.SIGMOID).corruptionLevel(0.3)momentum(0.3)..build())
              .layer(8,new OutputLayer.Builder(LossFunctions.LossFunction.SQUARED_LOSS).activation(Activation.IDENTITY).nIn(n2).nOut(n2).build())
              .pretrain(false).backprop(true)
              .build();
  
  
  
  
  
  
  
  
      MultiLayerNetwork network = new MultiLayerNetwork(configuration);
      network.init();
  
      DataSet dataSet=new DataSet(sinput,sinput);
  
  
  
      network.init();
      network.fit(new DataSet(dataSet.getFeatureMatrix(), dataSet.getFeatureMatrix()));             //training
      //network.fit(seisInput,seisInput);
      System.out.println("Layer 0 has "+network.getLayer(0).numParams()+" and Params: ");
      System.out.println(network.getLayer(0).params());
      System.out.println();
   //DataSet testDataSet=new DataSet(sinput,sinput);
     // DataSetIterator iterator=new INDArrayDataSetIterator()
  
      INDArray outputFromNet=network.output(testDataSet.getFeatureMatrix());
      INDArray reconstructedFromNet=network.reconstruct(outputFromNet,1); 
  </code></pre>