Package edu.ucla.sspace.matrix

Examples of edu.ucla.sspace.matrix.Matrix.rows()


        final Matrix leftMatrix = eigenCutter.getLeftCut();
        final Matrix rightMatrix = eigenCutter.getRightCut();

        verbose(String.format("Splitting into two matricies %d-%d",
                              leftMatrix.rows(), rightMatrix.rows()));

        // If the compute decided that the matrix should not be split, short
        // circuit any attempts to further cut the matrix.
        if (leftMatrix.rows() == matrix.rows() ||
            rightMatrix.rows() == matrix.rows())
View Full Code Here


                              leftMatrix.rows(), rightMatrix.rows()));

        // If the compute decided that the matrix should not be split, short
        // circuit any attempts to further cut the matrix.
        if (leftMatrix.rows() == matrix.rows() ||
            rightMatrix.rows() == matrix.rows())
            return new ClusterResult(new int[matrix.rows()], 1);


        // Do clustering on the left and right branches.  We can do this in
        // parallel because all of the data members in this class are thread
View Full Code Here

        final Matrix rightMatrix = eigenCutter.getRightCut();

        // If the compute decided that the matrix should not be split, short
        // circuit any attempts to further cut the matrix.
        if (leftMatrix.rows() == matrix.rows() ||
            rightMatrix.rows() == matrix.rows()) {
            eigenCutter.computeRhoSum(matrix);
            LimitedResult result;
            if (useKMeans)
                result = new KMeansLimitedResult(new int[matrix.rows()], 1,
                        eigenCutter.getKMeansObjective());
View Full Code Here

                        (matrix.rows() * (matrix.rows()-1)) / 2);
            return new LimitedResult[] {result};
        }

        verbose(String.format("Splitting into two matricies %d-%d",
                              leftMatrix.rows(), rightMatrix.rows()));

        // Do clustering on the left and right branches.  We can do this in
        // parallel because all of the data members in this class are thread
        // safe, since each call to fullCluster uses a new instance of a
        // EigenCutter which has all of the state for a particular partition.
View Full Code Here

        validateResults(reducer);
    }

    public static void validateResults(MatrixFactorization reducer) {
        Matrix U = reducer.dataClasses();
        assertEquals(matrix.rows(), U.rows());
        assertEquals(2, U.columns());

        for (int r = 0; r < matrix.rows(); ++r)
            for (int c = 0; c < 2; ++c)
                assertEquals(Math.abs(EXPECTED_U[r][c] * EXPECTED_S[c]),Math.abs(U.get(r,c)),.001);
 
View Full Code Here

        for (int r = 0; r < matrix.rows(); ++r)
            for (int c = 0; c < 2; ++c)
                assertEquals(Math.abs(EXPECTED_U[r][c] * EXPECTED_S[c]),Math.abs(U.get(r,c)),.001);

        Matrix V = reducer.classFeatures();
        assertEquals(2, V.rows());
        assertEquals(matrix.columns(), V.columns());

        for (int r = 0; r < 2; ++r)
            for (int c = 0; c < matrix.columns(); ++c)
                assertEquals(Math.abs(EXPECTED_V[r][c] * EXPECTED_S[r]),Math.abs(V.get(r,c)),.001);
 
View Full Code Here

        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());
View Full Code Here

        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) {
            for (int c = 0; c < 3; ++c) {
View Full Code Here

        List<MultiMap<Double, String>> topTerms = new ArrayList<MultiMap<Double, String>>();
        Matrix m = MatrixIO.readMatrix(new File(args[1]), Format.DENSE_TEXT);
        for (int c = 0; c < m.columns(); ++c)
            topTerms.add(new BoundedSortedMultiMap<Double, String>(10));

        for (int r = 0; r < m.rows(); ++r) {
            String term = basis.getDimensionDescription(r);
            for (int c = 0; c < m.columns(); ++c)
                topTerms.get(c).put(m.get(r, c), term);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.