Search in sources :

Example 1 with IntToFloatFunction

use of org.eclipse.collections.api.block.function.primitive.IntToFloatFunction in project narchy by automenta.

the class LivePredictorTest method test12_MLP.

@Test
public void test12_MLP() {
    IntToFloatFunction ii = x -> (float) Math.sin(x / 8f);
    IntToFloatFunction oo = x -> (float) Math.cos(x / 8f);
    LivePredictor.MLPPredictor model = new LivePredictor.MLPPredictor(0.03f);
    int iHistory = 4;
    int errorWindow = 16;
    int totalTime = 1024;
    float maxMeanError = 0.15f;
    assertCorrect(ii, oo, model, iHistory, errorWindow, totalTime, maxMeanError);
}
Also used : Test(org.junit.jupiter.api.Test) IntToFloatFunction(org.eclipse.collections.api.block.function.primitive.IntToFloatFunction) FloatSupplier(jcog.math.FloatSupplier) MutableInteger(jcog.math.MutableInteger) DescriptiveStatistics(org.apache.commons.math3.stat.descriptive.DescriptiveStatistics) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) IntToFloatFunction(org.eclipse.collections.api.block.function.primitive.IntToFloatFunction) Test(org.junit.jupiter.api.Test)

Example 2 with IntToFloatFunction

use of org.eclipse.collections.api.block.function.primitive.IntToFloatFunction in project narchy by automenta.

the class LivePredictorTest method test21_LSTM.

@Test
public void test21_LSTM() {
    IntToFloatFunction ii = x -> (float) Math.sin(x / 4f);
    IntToFloatFunction oo = x -> (float) Math.cos(x / 8f);
    LivePredictor.LSTMPredictor model = new LivePredictor.LSTMPredictor(0.5f, 1);
    int iHistory = 6;
    int errorWindow = 16;
    int totalTime = 8192 * 8;
    float maxMeanError = 0.1f;
    assertCorrect(ii, oo, model, iHistory, errorWindow, totalTime, maxMeanError);
}
Also used : Test(org.junit.jupiter.api.Test) IntToFloatFunction(org.eclipse.collections.api.block.function.primitive.IntToFloatFunction) FloatSupplier(jcog.math.FloatSupplier) MutableInteger(jcog.math.MutableInteger) DescriptiveStatistics(org.apache.commons.math3.stat.descriptive.DescriptiveStatistics) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) IntToFloatFunction(org.eclipse.collections.api.block.function.primitive.IntToFloatFunction) Test(org.junit.jupiter.api.Test)

Example 3 with IntToFloatFunction

use of org.eclipse.collections.api.block.function.primitive.IntToFloatFunction in project narchy by automenta.

the class LivePredictorTest method test1.

@Test
public void test1() {
    IntToFloatFunction ii = x -> (float) Math.sin(x / 4f);
    IntToFloatFunction oo = x -> (float) Math.cos(x / 4f);
    LivePredictor.LSTMPredictor model = new LivePredictor.LSTMPredictor(0.1f, 1);
    int iHistory = 4;
    int errorWindow = 16;
    int totalTime = 8192;
    float maxMeanError = 0.2f;
    assertCorrect(ii, oo, model, iHistory, errorWindow, totalTime, maxMeanError);
}
Also used : Test(org.junit.jupiter.api.Test) IntToFloatFunction(org.eclipse.collections.api.block.function.primitive.IntToFloatFunction) FloatSupplier(jcog.math.FloatSupplier) MutableInteger(jcog.math.MutableInteger) DescriptiveStatistics(org.apache.commons.math3.stat.descriptive.DescriptiveStatistics) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) IntToFloatFunction(org.eclipse.collections.api.block.function.primitive.IntToFloatFunction) Test(org.junit.jupiter.api.Test)

Aggregations

FloatSupplier (jcog.math.FloatSupplier)3 MutableInteger (jcog.math.MutableInteger)3 DescriptiveStatistics (org.apache.commons.math3.stat.descriptive.DescriptiveStatistics)3 IntToFloatFunction (org.eclipse.collections.api.block.function.primitive.IntToFloatFunction)3 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)3 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)3 Test (org.junit.jupiter.api.Test)3