增加最低信任度阈值

pull/1/head
lidapeng 5 years ago
parent ee37138818
commit b5839a4540

@ -12,6 +12,11 @@ import java.util.*;
public class RandomForest { public class RandomForest {
private Random random = new Random(); private Random random = new Random();
private Tree[] forest; private Tree[] forest;
private double trustTh = 0.1;//信任阈值
public void setTrustTh(double trustTh) {//设置信任阈值
this.trustTh = trustTh;
}
public RandomForest(int treeNub) throws Exception { public RandomForest(int treeNub) throws Exception {
if (treeNub > 0) { if (treeNub > 0) {
@ -67,6 +72,9 @@ public class RandomForest {
nub = myNub; nub = myNub;
} }
} }
if (nub < ArithUtil.mul(forest.length, trustTh)) {
type = 0;
}
return type; return type;
} }

Loading…
Cancel
Save