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);
}
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);
}
Aggregations