Search in sources :

Example 11 with UpdateFunc

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

the class UpdateFuncTest method testPow.

@Test
public void testPow() throws Exception {
    UpdateFunc func = new Pow(w2Client.getMatrixId(), 0, 3, 3.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], Math.pow(localArray0[i], 3.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 12 with UpdateFunc

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

the class UpdateFuncTest method testFloor.

@Test
public void testFloor() throws Exception {
    UpdateFunc func = new Floor(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.floor(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 13 with UpdateFunc

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

the class UpdateFuncTest method testDiv.

@Test
public void testDiv() throws Exception {
    UpdateFunc func = new Div(w2Client.getMatrixId(), 1, 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], 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 14 with UpdateFunc

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

the class UpdateFuncTest method testAddS.

@Test
public void testAddS() throws InvalidParameterException, InterruptedException, ExecutionException {
    UpdateFunc func = new AddS(w2Client.getMatrixId(), 0, 3, 2.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] + 2.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 15 with UpdateFunc

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

the class UpdateFuncTest method testExp.

@Test
public void testExp() throws Exception {
    UpdateFunc func = new Exp(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.exp(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)

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