隔离林异常检测算法的实现。
IsolationForest的Python项目详细描述
libisolationforest
说明
此项目包含RISE、C++和Python实现的隔离林算法。隔离林是一种基于随机生成决策树集合的异常检测算法。有关算法的完整说明,请参阅算法创建者的原始论文:
https://cs.nju.edu.cn/zhouzh/zhouzh.files/publication/icdm08b.pdf
python示例
python实现可以通过pip安装:
pip install IsolationForest
下面是一个简短的代码snipet,它展示了如何使用python版本的库。您还可以阅读文件test.py
以获得完整的示例。随着库的成熟,我将向这个文件添加更多的测试示例。
fromisolationforestimportIsolationForestforest=IsolationForest.Forest(num_trees,sub_sampling_size)sample=IsolationForest.Sample("Training Sample 1")features=[]features.append({"feature 1":feature_1_value})# Add more features to the sample...features.append({"feature N":feature_N_value})sample.add_features(features)# Add the features to the sample.forest.add_sample(sample)# Add more samples to the forest...# Create the forest.forest.create()sample=IsolationForest.Sample("Test Sample 1")features=[]features.append({"feature 1":feature_1_value})# Add more features to the sample...features.append({"feature N":feature_N_value})# Add the features to the sample.sample.add_features(features)# Score the sample.score=forest.score(sample)normalized_score=forest.normalized_score(sample)
生锈示例
可以在main.rs
中找到如何使用该库的rust版本的示例。随着库的成熟,我将向这个文件添加更多的测试示例。
版本历史记录
1.0
- 初始版本
1.1
- 增加了标准化分数。
- 更新了随机数生成的锈,因为它又变了。
许可证
此库是在mit许可下发布的,请参阅许可证以了解详细信息。