question: public double train ( double X_ [ ] [ ] , int batchSize , Random r ) throws Exception { initWeights ( X_ ) ; X_ = MatrixUtils . addBias ( X_ ) ; int N = X_ . length ; int N_n = ( int ) Math . ceil ( N * 1. / batchSize ) ; Matrix X_n [ ] = new Matrix [ N_n ] ; for ( int n = 0 , i = 0 ; n < N ; n += batchSize , i ++ ) { X_n [ i ] = new Matrix ( Arrays . copyOfRange ( X_ , n , Math . min ( n + batchSize , N ) ) ) ; } for ( int e = 0 ; e < m_E ; e ++ ) { for ( int i = 0 ; i < N_n ; i ++ ) { update ( X_n [ r . nextInt ( N_n ) ] ) ; } } return 1.0 ; }
target:  Train - Setup and batch-train the RBM on X, with some random sampling involved. <br> TODO should share code with train(X)