理论非常简单,不作赘述。
[结果]
score > 0.6和10颗树情况下,
score > 0.51和10颗树情况下
[数据]
链接:https://pan.baidu.com/s/1KW-g-mg00UzhYvtXe1vM7w
提取码:q6t6
复制这段内容后打开百度网盘手机App,操作更方便哦
[代码]
package IsoForest;
import org.ejml.data.DenseMatrix64F;
import java.io.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
class ITree{
}
class ITreeBranch extends ITree{
ITree left;
ITree right;
double splitValue;
int splitAttr;
public ITreeBranch(ITree left,ITree right,double splitValue,int splitAttr){
this.left = left;
this.right = right;
this.splitValue = splitValue;
this.splitAttr = splitAttr;
}
public ITree getLeft() {
return left;
}
public void setLeft(ITree left) {
this.left = left;
}
public ITree getRight() {
return right;
}
public void setRight(ITree right) {
this.right = right;
}
public double getSplitValue() {
return splitValue;
}
public void setSplitValue(double splitValue) {
this.splitValue = splitValue;
}
public int getSplitAttr() {
return splitAttr;
}
public void setSplitAttr(int splitAttr) {
this.splitAttr = splitAttr;
}
}
class ITreeLeaf extends ITree{
int size;
public ITreeLeaf(int size){
this.size = size;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
}
class IForest{
List<ITree> iTrees;
int maxSamples;
public IForest(List<ITree> iTrees, int maxSamples) {
this.iT