Package org.apache.mahout.math

Examples of org.apache.mahout.math.DenseMatrix.viewRow()


    /* Y' (Cu -I) Y by outer products */
    for (Element e : userRatings.nonZeroes()) {
      for (Vector.Element feature : Y.get(e.index()).all()) {
        Vector partial = CuMinusIY.get(e.index()).times(feature.get());
        YtransponseCuMinusIY.viewRow(feature.index()).assign(partial, Functions.PLUS);
      }
    }

    /* Y' (Cu - I) Y + λ I  add lambda on the diagonal */
    for (int feature = 0; feature < numFeatures; feature++) {
View Full Code Here


      int rowLabel = labels.viewRow( row ).maxValueIndex();
     
      if ( filter.containsKey(rowLabel)) {
       
        inputFiltered.viewRow(recFound).assign( input.viewRow(row) );
        labelsFiltered.viewRow(recFound).assign( labels.viewRow(row) );
        recFound++;
       
        if ( recFound >= inputFiltered.numRows() ) {
          break;
        }
View Full Code Here

        //System.out.println("line: " + line);
        //System.out.println("v in: " + v_in_0.toString());
       
        input_matrix.viewRow( row_num ).assign( v_in_0 );
       
        output_matrix.viewRow( row_num ).assign( v_out_0 );
       
        row_num++;
       
      }
      br.close()
View Full Code Here

    // vector 0
    for ( int row = 0; row < v.numRows(); row++ ) {
   
      for ( int col = 0; col < v.numCols(); col++ ) {
     
        assertEquals( v.viewRow(row).get(col), recon.viewRow(row).get(col), 0.3 );
     
      }
     
    }
   
View Full Code Here

      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
    Matrix input = new DenseMatrix( 1, v_in.size() );
    input.viewRow(0).assign(v_in);
     
    Matrix label = new DenseMatrix( 1, v_out.size() );
    label.viewRow(0).assign(v_out);
   
    boolean found = false;
View Full Code Here

   
    Matrix input = new DenseMatrix( 1, v_in.size() );
    input.viewRow(0).assign(v_in);
     
    Matrix label = new DenseMatrix( 1, v_out.size() );
    label.viewRow(0).assign(v_out);
   
    boolean found = false;
   
    for (int col = 0; col < label.numCols(); col++) {
     
View Full Code Here

             
              input_matrix.viewRow( vec_count ).set(x, Double.parseDouble( parts[ x ] ));
             
            } else {
           
              output_matrix.viewRow( vec_count ).assign(0);
              output_matrix.viewRow( vec_count ).set( Integer.parseInt( parts[ x ] ) - 1, 1.0 );
            }
          }
         
          vec_count++;
View Full Code Here

              input_matrix.viewRow( vec_count ).set(x, Double.parseDouble( parts[ x ] ));
             
            } else {
           
              output_matrix.viewRow( vec_count ).assign(0);
              output_matrix.viewRow( vec_count ).set( Integer.parseInt( parts[ x ] ) - 1, 1.0 );
            }
          }
         
          vec_count++;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.