Mahout Source Code Analysis of Distributedlanczossolver (v)

Source: Internet
Author: User

Mahout version: 0.7,hadoop version: 1.0.4,jdk:1.7.0_25 64bit.

1. Job Posts

Next, analyze the Run method of Eigenverificationjob:

public int Run (path corpusinput, path eigeninput, path output, P Ath Tempout, double maxerror, Double Mineigenvalue, Boolean Inmem  
    Ory, Configuration conf) throws IOException {this.outpath = output;  
    This.tmpout = Tempout;  
    This.maxerror = Maxerror;  
      
    This.mineigenvalue = Mineigenvalue;  
    if (eigeninput!= null && eigenstoverify = null) {prepareeigens (conf, eigeninput, inmemory);  
    } Distributedrowmatrix C = new Distributedrowmatrix (Corpusinput, Tempout, 1, 1);  
    c.setconf (conf);  
      
    corpus = C; Set up Eigenverifier and Orthoverifier todo:allow multithreaded execution eigenverifier = new Simpleeigen  
      
    Verifier ();  
    We don ' t currently verify orthonormality here.  
      
  Vectoriterable pairwiseinnerproducts = Computepairwiseinnerproducts ();  Map<matrixslice, eigenstatus> eigenmetadata = Verifyeigens ();  
      
    List<map.entry<matrixslice, eigenstatus>> Prunedeigenmeta = Pruneeigens (EigenMetaData);  
    Savecleaneigens (New Configuration (), Prunedeigenmeta);  
  return 0; }

Here first clear a few input parameters, InputPath, OutputPath, TempPath do not have to say, Eigenpath is the last generated raweigenvectors file; InMemory is false, Maxerror is the 0.05,mineigenvalue is 0.0; by the way, if you run this class directly, it's not going to work, like the following call:

Package MAHOUT.FANSY.SVD;  
      
Import java.io.IOException;  
Import org.apache.hadoop.conf.Configuration;  
Import Org.apache.hadoop.fs.Path;  
      
Import Org.apache.mahout.math.hadoop.decomposer.EigenVerificationJob; public class Runeigenverificationjob {/** * Call Eigenverificationjob * * private static Path P  
    Refix=new Path ("hdfs://ubuntu:9000");  
        public static void Main (string[] args) throws IOException {path inputpath=new path (prefix, "/svd/input/wine");  
        Path raweigenvectorpath=new path (prefix, "/svd/output1/raweigenvectors");  
        Path outputpath=new path (prefix, "/svd/output1/cleaneigenvectors");  
        Path outputtmppath=new path (prefix, "/svd/temp");  
              
        Double maxerror=0.5;  
        Double mineigenvalue=0.0;  
        Boolean inmemory=false;  
        Configuration conf=new Configuration ();  
        Conf.set ("Mapred.job.tracker", "ubuntu:9001"); int Result=new EigenverifiCationjob (). Run (InputPath, Raweigenvectorpath, OutputPath, outputtmp  
        Path, Maxerror, Mineigenvalue, inmemory, conf); SYSTEM.OUT.PRINTLN ("result success?")  
    + (Result==0?true:false)); }  
      
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.