List of usage examples for org.apache.mahout.math.hadoop MatrixColumnMeansJob run
public static Vector run(Configuration initialConf, Path inputPath, Path outputVectorTmpPath, String vectorClass) throws IOException
From source file:at.illecker.hadoop.rootbeer.examples.matrixmultiplication.DistributedRowMatrix.java
License:Apache License
/** * Returns the column-wise mean of a DistributedRowMatrix * // w w w .j a v a 2s. c o m * @param vectorClass desired class for the column-wise mean vector e.g. * RandomAccessSparseVector, DenseVector * @return Vector containing the column-wise mean of this */ public Vector columnMeans(String vectorClass) throws IOException { Path outputVectorTmpPath = new Path(outputTmpBasePath, new Path(Long.toString(System.nanoTime()))); Configuration initialConf = getConf() == null ? new Configuration() : getConf(); String vectorClassFull = "org.apache.mahout.math." + vectorClass; Vector mean = MatrixColumnMeansJob.run(initialConf, rowPath, outputVectorTmpPath, vectorClassFull); if (!keepTempFiles) { FileSystem fs = outputVectorTmpPath.getFileSystem(conf); fs.delete(outputVectorTmpPath, true); } return mean; }