Search in sources :

Example 21 with UpdateFunc

use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.

the class UpdateFuncTest method testDivS.

@Test
public void testDivS() throws Exception {
    UpdateFunc func = new DivS(w2Client.getMatrixId(), 0, 3, -1.0);
    w2Client.update(func).get();
    double[] result = pull(w2Client, 3);
    assert (result.length == dim);
    for (int i = 0; i < result.length; i++) {
        Assert.assertEquals(result[i], localArray0[i] / -1.0, delta);
    }
}
Also used : CompressUpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.CompressUpdateFunc) UpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc) Test(org.junit.Test)

Example 22 with UpdateFunc

use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.

the class UpdateFuncTest method testIncrement.

@Test
public void testIncrement() throws Exception {
    UpdateFunc func = new Increment(w2Client.getMatrixId(), 3, localArray1);
    w2Client.update(func).get();
    double[] result = pull(w2Client, 3);
    assert (result.length == dim);
    for (int i = 0; i < result.length; i++) {
        Assert.assertEquals(result[i], 0.0 + localArray1[i], delta);
    }
}
Also used : CompressUpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.CompressUpdateFunc) UpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc) Increment(com.tencent.angel.ml.matrix.psf.update.Increment) Test(org.junit.Test)

Example 23 with UpdateFunc

use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.

the class UpdateFuncTest method testCeil.

@Test
public void testCeil() throws Exception {
    UpdateFunc func = new Ceil(w2Client.getMatrixId(), 0, 3);
    w2Client.update(func).get();
    double[] result = pull(w2Client, 3);
    assert (result.length == dim);
    for (int i = 0; i < result.length; i++) {
        Assert.assertEquals(result[i], Math.ceil(localArray0[i]), delta);
    }
}
Also used : CompressUpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.CompressUpdateFunc) UpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc) Test(org.junit.Test)

Example 24 with UpdateFunc

use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.

the class UpdateFuncTest method testMaxV.

@Test
public void testMaxV() throws Exception {
    UpdateFunc func = new MaxV(w2Client.getMatrixId(), 0, 1, 3);
    w2Client.update(func).get();
    double[] result = pull(w2Client, 3);
    assert (result.length == dim);
    for (int i = 0; i < result.length; i++) {
        Assert.assertEquals(result[i], Math.max(localArray1[i], localArray0[i]), delta);
    }
}
Also used : CompressUpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.CompressUpdateFunc) UpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc) Test(org.junit.Test)

Example 25 with UpdateFunc

use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.

the class UpdateFuncTest method testMulS.

@Test
public void testMulS() throws Exception {
    UpdateFunc func = new MulS(w2Client.getMatrixId(), 0, 3, -1.0);
    w2Client.update(func).get();
    double[] addResult = pull(w2Client, 3);
    assert (addResult.length == dim);
    for (int i = 0; i < addResult.length; i++) {
        Assert.assertEquals(addResult[i], localArray0[i] * -1.0, delta);
    }
}
Also used : CompressUpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.CompressUpdateFunc) UpdateFunc(com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc) Test(org.junit.Test)

Aggregations

UpdateFunc (com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc)32 CompressUpdateFunc (com.tencent.angel.ml.matrix.psf.update.enhance.CompressUpdateFunc)31 Test (org.junit.Test)31 Push (com.tencent.angel.ml.matrix.psf.update.Push)2 PartitionKey (com.tencent.angel.PartitionKey)1 PartitionLocation (com.tencent.angel.ml.matrix.PartitionLocation)1 Increment (com.tencent.angel.ml.matrix.psf.update.Increment)1 ByteBuf (io.netty.buffer.ByteBuf)1