Examples of rows()


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

        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

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

        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

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

        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

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

        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

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

        corpusReader.close();

        // If the term is to be processed using fewer than all of its contexts,
        // then randomly select the maximum allowable contexts from the matrix
        if (maxContextsPerWord < Integer.MAX_VALUE &&
                contextsForCurTerm.rows() > maxContextsPerWord) {
            BitSet randomContexts = Statistics.randomDistribution(
                maxContextsPerWord, contextsForCurTerm.rows());
            contextsForCurTerm =
                new SparseRowMaskedMatrix(contextsForCurTerm, randomContexts);
        }
View Full Code Here

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

        // If the term is to be processed using fewer than all of its contexts,
        // then randomly select the maximum allowable contexts from the matrix
        if (maxContextsPerWord < Integer.MAX_VALUE &&
                contextsForCurTerm.rows() > maxContextsPerWord) {
            BitSet randomContexts = Statistics.randomDistribution(
                maxContextsPerWord, contextsForCurTerm.rows());
            contextsForCurTerm =
                new SparseRowMaskedMatrix(contextsForCurTerm, randomContexts);
        }
       
        return contextsForCurTerm;
View Full Code Here

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

        SparseMatrix sm = (SparseMatrix)m;
       
        // Create a bit set with the number of bits equal to the number of rows.
        // This serves as input to phase 2 where we indicate that all rows
        // should be considered for clustering at first.
        BitSet allRows = new BitSet(sm.rows());
        allRows.set(0, sm.rows());
        LOGGER.info("CBC begining Phase 2");
        List<Committee> committees = phase2(
            sm, allRows, avgLinkMergeThresh,
            maxCommitteeSimThresh, residueSimThresh);
View Full Code Here

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

       
        // Create a bit set with the number of bits equal to the number of rows.
        // This serves as input to phase 2 where we indicate that all rows
        // should be considered for clustering at first.
        BitSet allRows = new BitSet(sm.rows());
        allRows.set(0, sm.rows());
        LOGGER.info("CBC begining Phase 2");
        List<Committee> committees = phase2(
            sm, allRows, avgLinkMergeThresh,
            maxCommitteeSimThresh, residueSimThresh);
       
View Full Code Here

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

        // However, we currently don't optimize for this special case and
        // instead use our HAC class.  Because of the complexity of the edge
        // similarity function, we build our own similarity matrix and then pass
        // it in, rather than passing in the edge matrix directly.

        final int rows = sm.rows();
        numRows = rows;
        LOGGER.fine("Generating link similarity matrix for " + rows + " nodes");

        //  Rather than create an O(row^3) matrix for representing the edges,
        // compress the edge matrix by getting a mapping for each edge to a row
View Full Code Here

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

    protected static DoubleVector computeMatrixTransposeV(Matrix matrix,
                                                          DoubleVector v) {
        DoubleVector newV = new DenseVector(matrix.columns());
        if (matrix instanceof SparseMatrix) {
            SparseMatrix smatrix = (SparseMatrix) matrix;
            for (int r = 0; r < smatrix.rows(); ++r) {
                SparseDoubleVector row = smatrix.getRowVector(r);
                int[] nonZeros = row.getNonZeroIndices();
                for (int c : nonZeros)
                    newV.add(c, row.get(c) * v.get(r));
            }
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.