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)); }
}