我已经制作了一个Mamdani模糊系统,并且知道我想在MatLab中测试25%的测试数据,
首先,我基于75%的数据制作了c4.5决策树,然后从中提取规则,然后将规则导入到Matlab中的Mamdani Fuzzy工具箱中。
为了验证和计算精度,我在下面的代码中使用了其他方法来计算精度吗?还是不?
fismat = readfis('main_fis.fis');
% fismat = readfis;
test_data = csvread('new_real_dataset2_3000_without_class_label1.csv');
test_label = csvread('new_real_dataset2_3000_class_label1.csv');
anfis_output = evalfis(test_data , fismat);
for i=1 : length (anfis_output)
anfis_output(i)= round(anfis_output(i));
end
tp = sum((anfis_output == 1) & (test_label == 1));
fp = sum((anfis_output == 1) & (test_label == 0));
fn = sum((anfis_output == 0) & (test_label == 1));
tn = sum((anfis_output == 0) & (test_label == 0));
Accuracy = (tp + tn) / (tp + tn + fp + fn)
我找到了上面的代码,但是我认为应该有其他方法来计算准确性。