Package org.apache.mahout.math.hadoop

Examples of org.apache.mahout.math.hadoop.TransposeJob$TransposeReducer


        // calculate the co-occurrence matrix [B'A]

        // since the matrices were ingested and stored transposed we need to transpose again, just so the
        // multiply can transpose yet again - argh!
        ToolRunner.run(getConf(), new TransposeJob(), new String[]{
            "--input", matrixBTransposePath.toString(),
            "--numRows", Integer.toString(numberOfUsers),
            "--numCols", Integer.toString(numberOfItems),
            "--tempDir", tempPath.toString(),
        });
        Path matrixBPath = findMostRecentPath(prepPath, "transpose");

        // now get A from the ingested transposed version
        ToolRunner.run(getConf(), new TransposeJob(), new String[]{
            "--input", matrixATransposePath.toString(),
            "--numRows", Integer.toString(numberOfUsers),
            "--numCols", Integer.toString(numberOfItems),
            "--tempDir", tempPath.toString(),
        });
        Path matrixAPath = findMostRecentPath(prepPath, "transpose");


        // this actually does a matrixB.transpose.times(matrixA)
        Path cooccurrenceMatrixPath = getTempPath(CO_OCCURRENCE_MATRIX);

        ToolRunner.run(getConf(), new MatrixMultiplicationJob(), new String[]{
            "--numRowsA", Integer.toString(numberOfUsers),
            "--numColsA", Integer.toString(numberOfItems),
            "--numRowsB", Integer.toString(numberOfUsers),
            "--numColsB", Integer.toString(numberOfItems),
            "--inputPathA", matrixBPath.toString(),
            "--inputPathB", matrixAPath.toString(),
            // huh, no option of this name???? todo: do we have to find it after the mult?
            "--outputPath", cooccurrenceMatrixPath.toString(),
            "--tempDir", tempPath.toString(),
        });

        // now [B'A] will be transposed before the multiply so we need to transpose twice?
        // calculating [B'A]H_v by first transposing the [B'A] then creating the multiply job but
        // H_v is A' (a users view history vectors are column vectors) so we have to transpose both [B'A] and A
        // since the multiply will automatically transpose the first matrix (not sure why but it does).

        ToolRunner.run(getConf(), new TransposeJob(), new String[]{
            "--input", cooccurrenceMatrixPath.toString(),
            "--numRows", Integer.toString(numberOfUsers),
            "--numCols", Integer.toString(numberOfItems),
            "--tempDir", tempPath.toString(),
        });
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.hadoop.TransposeJob$TransposeReducer

Copyright © 2018 www.massapicom. 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.