【问题标题】:Fuzzy Logic Truthfulness Demonstration模糊逻辑真实性论证
【发布时间】:2014-07-24 06:34:06
【问题描述】:

我正在创建一个简单的示例来展示模糊逻辑的真实性。 问题在于确定结果的真实性。

我的第一个担忧:通过测试高低目标之间的真实值,这真的使用模糊逻辑吗?

我的第二个担忧:真实性 % 似乎对于目标/阈值命中不正确。

结果:

Miss: 30
 Hit: 40 at 100% true ( should be 80% ? )
 Hit: 50 at 80% true  ( should be 100% ? )
 Hit: 60 at 66% true  ( should be 80% ? )
Miss: 70

类:

public class FuzzyTest {

class Result {    
    int value;
    int truthfullness;
}

Result evaluate(final int valueIn, final int target, final int threshold) {
    Result result = null;
    final boolean truth = (((target - threshold) <= valueIn) && (valueIn <= (target + threshold)));
    if (truth) {
        result = new Result();
        result.value = valueIn;
        result.truthfullness = (int) (100.0 - (100.0 * (valueIn - Math.abs(target - threshold)) / valueIn));
    }
    return result;
}

public static void main(final String[] args) {
    final int[] arrayIn = new int[] { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
    final int threshold = 10;
    final int target = 50;
    final FuzzyTest fuzzy = new FuzzyTest();
    for (final int x : arrayIn) {
        final Result result = fuzzy.evaluate(x, target, threshold);
        if (result == null) {
            System.out.println("Miss: " + x);
        }
        else {
            System.out.println("Hit: " + x + " at " + result.truthfullness + "% true");
        }
    }
}
}

【问题讨论】:

  • 似乎 40 和 60 的命中率应该接近 0%(不是 80%),而 45 和 55 的命中率应该是 50%。

标签: java fuzzy-logic


【解决方案1】:

通过测试高低目标之间的真实值,这真的是使用模糊逻辑吗?

没有。它仍然是相同的布尔逻辑。要真正获得模糊值,您必须从输入变量的模糊函数中获取模糊值。

模糊函数是一个函数,它接收一个实值并返回一个介于 0 和 1 之间的值。它说明了该变量的真实程度。例如,在下图中(取自关于 Fuzzy 的维基百科文章),实际温度值将具有“冷”、“暖”和“热”的程度。这些价值观就是你的真实。

对于目标/阈值命中,真实性 % 似乎不正确。

是的,这是不正确的。首先,因为您的阈值实际上在模糊定义中介于 0 和 1 之间(因此,您已经有了一个百分比)。其次,如果您定义的阈值为 [0, 100],则它不是 Fuzzy。


如果您正在使用 Java 创建一个模糊系统(即使是一个简单的系统),我可以建议一个好的框架来完成它吗?尝试使用jFuzzyLogic。它将帮助您对 Fuzzy 系统进行编程并了解 Fuzzy 的工作原理。

【讨论】:

    【解决方案2】:

    试试这个以获得你想要的值:

    result.truthfullness = (int) (100.0 - (100.0 * Math.abs(target - valueIn)) / target);
    

    它给出了这个结果:

    Miss: 30
    Hit: 40 at 80% true
    Hit: 50 at 100% true
    Hit: 60 at 80% true
    Miss: 70
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-18
      • 1970-01-01
      • 2016-03-17
      • 2011-05-17
      • 2016-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多