Search in sources :

Example 1 with DelegatingVector

use of org.apache.ignite.ml.math.primitives.vector.impl.DelegatingVector in project ignite by apache.

the class DelegatingVectorConstructorTest method basicTest.

/**
 */
@Test
public void basicTest() {
    final Vector parent = new DenseVector(new double[] { 0, 1 });
    final DelegatingVector delegate = new DelegatingVector(parent);
    final int size = parent.size();
    assertEquals("Delegate size differs from expected.", size, delegate.size());
    assertEquals("Delegate vector differs from expected.", parent, delegate.getVector());
    for (int idx = 0; idx < size; idx++) assertDelegate(parent, delegate, idx);
}
Also used : DelegatingVector(org.apache.ignite.ml.math.primitives.vector.impl.DelegatingVector) DelegatingVector(org.apache.ignite.ml.math.primitives.vector.impl.DelegatingVector) DenseVector(org.apache.ignite.ml.math.primitives.vector.impl.DenseVector) DenseVector(org.apache.ignite.ml.math.primitives.vector.impl.DenseVector) Test(org.junit.Test)

Example 2 with DelegatingVector

use of org.apache.ignite.ml.math.primitives.vector.impl.DelegatingVector in project ignite by apache.

the class ExternalizeTest method test.

/**
 */
@Test
@SuppressWarnings("unchecked")
public void test() {
    externalizeTest(new DelegatingVector(new DenseVector(1)));
    externalizeTest(new VectorizedViewMatrix(new DenseMatrix(2, 2), 1, 1, 1, 1));
    externalizeTest(new ManhattanDistance());
    externalizeTest(new HammingDistance());
    externalizeTest(new EuclideanDistance());
    externalizeTest(new FeatureMetadata());
    externalizeTest(new VectorizedViewMatrix(new DenseMatrix(2, 2), 1, 1, 1, 1));
    externalizeTest(new DatasetRow<>(new DenseVector()));
    externalizeTest(new LabeledVector<>(new DenseVector(), null));
    externalizeTest(new Dataset<DatasetRow<Vector>>(new DatasetRow[] {}, new FeatureMetadata[] {}));
}
Also used : FeatureMetadata(org.apache.ignite.ml.structures.FeatureMetadata) EuclideanDistance(org.apache.ignite.ml.math.distances.EuclideanDistance) HammingDistance(org.apache.ignite.ml.math.distances.HammingDistance) DatasetRow(org.apache.ignite.ml.structures.DatasetRow) VectorizedViewMatrix(org.apache.ignite.ml.math.primitives.vector.impl.VectorizedViewMatrix) DelegatingVector(org.apache.ignite.ml.math.primitives.vector.impl.DelegatingVector) DenseVector(org.apache.ignite.ml.math.primitives.vector.impl.DenseVector) ManhattanDistance(org.apache.ignite.ml.math.distances.ManhattanDistance) DenseMatrix(org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix) Test(org.junit.Test)

Aggregations

DelegatingVector (org.apache.ignite.ml.math.primitives.vector.impl.DelegatingVector)2 DenseVector (org.apache.ignite.ml.math.primitives.vector.impl.DenseVector)2 Test (org.junit.Test)2 EuclideanDistance (org.apache.ignite.ml.math.distances.EuclideanDistance)1 HammingDistance (org.apache.ignite.ml.math.distances.HammingDistance)1 ManhattanDistance (org.apache.ignite.ml.math.distances.ManhattanDistance)1 DenseMatrix (org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix)1 VectorizedViewMatrix (org.apache.ignite.ml.math.primitives.vector.impl.VectorizedViewMatrix)1 DatasetRow (org.apache.ignite.ml.structures.DatasetRow)1 FeatureMetadata (org.apache.ignite.ml.structures.FeatureMetadata)1