Package org.apache.mahout.math.matrix

Examples of org.apache.mahout.math.matrix.DoubleMatrix2D


    @Test
    public void testNormalizeColumnsL2()
    {
        /** A matrix with unnormalized columns */
        DoubleMatrix2D unnormalisedColumns = nonZeroColumnMatrix();
        MatrixUtils.normalizeColumnL2(unnormalisedColumns, null);

        checkL2Normalization(unnormalisedColumns);
    }
View Full Code Here


    @Test
    public void testNormalizeColumnsL2Zeros()
    {
        /** A matrix with unnormalized columns */
        DoubleMatrix2D unnormalisedColumns = zeroColumnMatrix();
        MatrixUtils.normalizeColumnL2(unnormalisedColumns, null);

        checkL2Normalization(unnormalisedColumns);
    }
View Full Code Here

    @Test
    public void testSparseNormalizeColumnsL2()
    {
        /** A matrix with unnormalized columns */
        DoubleMatrix2D unnormalisedColumns = nonZeroColumnMatrix();
        MatrixUtils.normalizeSparseColumnL2(unnormalisedColumns, null);

        checkL2Normalization(unnormalisedColumns);
    }
View Full Code Here

    @Test
    public void testSparseNormalizeColumnsL2Zeros()
    {
        /** A matrix with unnormalized columns */
        DoubleMatrix2D unnormalisedColumns = zeroColumnMatrix();
        MatrixUtils.normalizeSparseColumnL2(unnormalisedColumns, null);

        checkL2Normalization(unnormalisedColumns);
    }
View Full Code Here

    }

    @Test
    public void testMinSparseness()
    {
        final DoubleMatrix2D sparse = new DenseDoubleMatrix2D(2, 2);
        assertThat(MatrixUtils.computeSparseness(sparse)).isEqualTo(0);
    }
View Full Code Here

    }

    @Test
    public void testMaxSparseness()
    {
        final DoubleMatrix2D sparse = new DenseDoubleMatrix2D(2, 2);
        sparse.assign(3);
        assertThat(MatrixUtils.computeSparseness(sparse)).isEqualTo(1);
    }
View Full Code Here

        factory.setK(2);

        PartialSingularValueDecomposition factorization = (PartialSingularValueDecomposition) factory
            .factorize(A);

        DoubleMatrix2D expectedU = new DenseDoubleMatrix2D(new double [] []
        {
            {
                0, 0.752646
            },
            {
                -0.651927, 0
            },
            {
                -0.651927, 0
            },
            {
                -0.387277, 0
            },
            {
                0, 0.658425
            }
        });

        DoubleMatrix2D expectedV = new DenseDoubleMatrix2D(new double [] []
        {
            {
                -0.557873, 0
            },
            {
View Full Code Here

    }

    @Test
    public void testUnorderedNMFED()
    {
        DoubleMatrix2D expectedU = new DenseDoubleMatrix2D(new double [] []
        {
            {
                6.1201e-011, 0.99592
            },
            {
                1.3886, 6.9024e-070
            },
            {
                1.3886, 8.2856e-070
            },
            {
                0.82488, 7.4263e-066
            },
            {
                5.8999e-011, 0.87124
            }
        });

        DoubleMatrix2D expectedV = new DenseDoubleMatrix2D(new double [] []
        {
            {
                0.43087, 1.0265e-069
            },
            {
View Full Code Here

    }

    @Test
    public void testKMeans()
    {
        DoubleMatrix2D expectedU = new DenseDoubleMatrix2D(new double [] []
        {
            {
                0.7380, 0
            },
            {
                0, 0.6832
            },
            {
                0, 0.6832
            },
            {
                0.3481, 0.2575
            },
            {
                0.5779, 0
            }
        });

        DoubleMatrix2D expectedV = new DenseDoubleMatrix2D(new double [] []
        {
            {
                0, 1
            },
            {
View Full Code Here

    }

    @Test
    public void testOrderedNMFED()
    {
        DoubleMatrix2D expectedU = new DenseDoubleMatrix2D(new double [] []
        {
            {
                0.99592, 6.1201e-011
            },
            {
                6.9024e-070, 1.3886
            },
            {
                8.2856e-070, 1.3886
            },
            {
                7.4263e-066, 0.82488
            },
            {
                0.87124, 5.8999e-011
            }
        });

        DoubleMatrix2D expectedV = new DenseDoubleMatrix2D(new double [] []
        {
            {
                1.0265e-069, 0.43087
            },
            {
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.matrix.DoubleMatrix2D

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.