Search in sources :

Example 1 with ArrayComparisonFailure

use of org.junit.internal.ArrayComparisonFailure in project ignite by apache.

the class VectorGeneratorTest method duplicateRandomFeatures.

/**
 */
@Test
public void duplicateRandomFeatures() {
    VectorGenerator g1 = VectorGeneratorPrimitives.constant(VectorUtils.of(1., 2., 3., 4.)).duplicateRandomFeatures(2, 1L);
    double[] exp = { 1., 2., 3., 4., 3., 1. };
    Vector v1 = g1.get();
    Vector v2 = g1.get();
    assertArrayEquals(exp, v1.asArray(), 1e-7);
    try {
        assertArrayEquals(v1.asArray(), v2.asArray(), 1e-7);
    } catch (ArrayComparisonFailure e) {
    // this is valid situation - duplicator should get different features
    }
}
Also used : ArrayComparisonFailure(org.junit.internal.ArrayComparisonFailure) Vector(org.apache.ignite.ml.math.primitives.vector.Vector) Test(org.junit.Test)

Aggregations

Vector (org.apache.ignite.ml.math.primitives.vector.Vector)1 Test (org.junit.Test)1 ArrayComparisonFailure (org.junit.internal.ArrayComparisonFailure)1