Package edu.ucla.sspace.matrix

Examples of edu.ucla.sspace.matrix.MatrixFactorization


            Transform transform = new LogEntropyTransform();
            if (argOptions.hasOption("preprocess"))
                transform = ReflectionUtil.getObjectInstance(
                        argOptions.getStringOption("preprocess"));
            String algName = argOptions.getStringOption("svdAlgorithm", "ANY");
            MatrixFactorization factorization =
                new NonNegativeMatrixFactorizationMultiplicative();
            basis = new StringBasisMapping();

            throw new IOException("Not sure what to do");
//             return new LatentSemanticAnalysis(
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public SemanticSpace getSpace() {
        Transform transform = new CorrelationTransform();
        MatrixFactorization reducer = (argOptions.hasOption("reduce"))
            ? SVD.getFastestAvailableFactorization()
            : null;

        return new Coals(transform, reducer,
                         argOptions.getIntOption("reducedDimension", 0),
View Full Code Here

        {7.9927, 7.7644, 8.2610},
        {9.3377, 0.1572, 12.4930},
    };

    @Test public void testReduction() {
        MatrixFactorization reducer =
            new NonNegativeMatrixFactorizationMultiplicative();
        SparseMatrix matrix = new YaleSparseMatrix(VALUES);

        reducer.factorize(matrix, 2);

        Matrix W = reducer.dataClasses();
        assertEquals(4, W.rows());
        assertEquals(2, W.columns());

        Matrix H = reducer.classFeatures();
        assertEquals(2, H.rows());
        assertEquals(3, H.columns());

        /*
        for (int r = 0; r < 4; ++r) {
View Full Code Here

        options.parseOptions(args);

        LoggerUtil.setLevel(Level.FINE);

        int dimensions = options.getIntOption('r');
        MatrixFactorization reducer = null;
        Format format = null;
        if (options.getStringOption('a').equals("NMF")) {
            reducer = new NonNegativeMatrixFactorizationMultiplicative();
            format = Format.MATLAB_SPARSE;
        } else if (options.getStringOption('a').equals("SVD")) {
            reducer = SVD.getFastestAvailableFactorization();
            format = Format.SVDLIBC_SPARSE_BINARY;
        } else
            System.exit(1);


        MatrixFile mFile = new MatrixFile(new File(options.getPositionalArg(0)),
                                          format);

        reducer.factorize(mFile, dimensions);

        File wordSpaceFile = new File(options.getStringOption('w'));
        MatrixIO.writeMatrix(reducer.dataClasses(), wordSpaceFile,
                             Format.DENSE_TEXT);

        File docSpaceFile = new File(options.getStringOption('d'));
        MatrixIO.writeMatrix(reducer.classFeatures(), docSpaceFile,
                             Format.DENSE_TEXT);
    }
View Full Code Here

            : Format.SVDLIBC_SPARSE_TEXT;
        Format outputFormat = (options.hasOption('w'))
            ? getFormat(options.getStringOption('w'))
            : Format.SVDLIBC_DENSE_TEXT;

        MatrixFactorization factorizer = SVD.getFastestAvailableFactorization();
        factorizer.factorize(new MatrixFile(matrixFile, inputFormat), dimensions);
        File uFile = new File(outputDir, "U.mat");
        MatrixIO.writeMatrix(factorizer.dataClasses(), uFile, outputFormat);
        File vFile = new File(outputDir, "V.mat");
        MatrixIO.writeMatrix(factorizer.classFeatures(), vFile, outputFormat);
    }
View Full Code Here

TOP

Related Classes of edu.ucla.sspace.matrix.MatrixFactorization

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.