Search in sources :

Example 1 with FloatNormalized

use of jcog.math.FloatNormalized in project narchy by automenta.

the class DigitizedScalarTest method testRewardConceptsFuzzification3.

// @Test
// public void testRewardConceptsFuzzification1() {
// NAR d = new Default();
// MutableFloat m = new MutableFloat(0f);
// 
// testSteadyFreqCondition(m,
// new FuzzyScalarConcepts(
// new FloatNormalized(() -> m.floatValue()).updateRange(-1).updateRange(1),
// d, FuzzyScalarConcepts.FuzzyTriangle, $.p("x")),
// (f) -> Util.equals(f, 0.5f + 0.5f * m.floatValue(), tolerance)
// );
// }
@Disabled
@Test
public void testRewardConceptsFuzzification3() {
    NAR n = NARS.shell();
    MutableFloat m = new MutableFloat(0f);
    FloatNormalized range = new FloatPolarNormalized(() -> m.floatValue(), 1f);
    DigitizedScalar f = new DigitizedScalar(range, DigitizedScalar.FuzzyNeedle, n, $.p("low"), $.p("mid"), $.p("hih"));
    // {
    // f.clear();
    // m.setValue(0); d.next();
    // System.out.println(Texts.n4(m.floatValue()) + "\t" + f.toString());
    // assertEquals("(I-->[sad]) %0.25;.90%\t(I-->[neutral]) %1.0;.90%\t(I-->[happy]) %0.0;.90%", f.toString());
    // }
    // 
    // {
    // f.clear();
    // m.setValue(-1); d.next();
    // System.out.println(Texts.n4(m.floatValue()) + "\t" + f.toString());
    // assertEquals("(I-->[sad]) %1.0;.90%\t(I-->[neutral]) %0.0;.90%\t(I-->[happy]) %0.0;.90%", f.toString());
    // }
    // 
    // {
    // f.clear();
    // m.setValue(+1); d.next();
    // System.out.println(Texts.n4(m.floatValue()) + "\t" + f.toString());
    // assertEquals("(I-->[sad]) %0.0;.90%\t(I-->[neutral]) %0.0;.90%\t(I-->[happy]) %1.0;.90%", f.toString());
    // }
    testSteadyFreqCondition(m, f, (freqSum) -> {
        System.out.println(freqSum + " " + tolerance);
        return Util.equals(freqSum, 1f, tolerance);
    }, n);
}
Also used : FloatNormalized(jcog.math.FloatNormalized) MutableFloat(org.apache.commons.lang3.mutable.MutableFloat) DigitizedScalar(nars.concept.scalar.DigitizedScalar) FloatPolarNormalized(jcog.math.FloatPolarNormalized) NAR(nars.NAR) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 2 with FloatNormalized

use of jcog.math.FloatNormalized in project narchy by automenta.

the class DigitizedScalarTest method testRewardConceptsFuzzification2.

@Test
public void testRewardConceptsFuzzification2() {
    NAR n = NARS.tmp();
    MutableFloat x = new MutableFloat(0f);
    testSteadyFreqCondition(x, new DigitizedScalar(new FloatNormalized(x::floatValue).updateRange(-1).updateRange(1), DigitizedScalar.FuzzyBinary, n, $.p("x0"), $.p("x1"), $.p("x2")), (f) -> true, /*Util.equals(f, 0.5f + 0.5f * m.floatValue(), tolerance)*/
    n);
}
Also used : FloatNormalized(jcog.math.FloatNormalized) MutableFloat(org.apache.commons.lang3.mutable.MutableFloat) DigitizedScalar(nars.concept.scalar.DigitizedScalar) NAR(nars.NAR) Test(org.junit.jupiter.api.Test)

Aggregations

FloatNormalized (jcog.math.FloatNormalized)2 NAR (nars.NAR)2 DigitizedScalar (nars.concept.scalar.DigitizedScalar)2 MutableFloat (org.apache.commons.lang3.mutable.MutableFloat)2 Test (org.junit.jupiter.api.Test)2 FloatPolarNormalized (jcog.math.FloatPolarNormalized)1 Disabled (org.junit.jupiter.api.Disabled)1