python - 关于 scikit-learn 的 IsolationForest 异常分数计算变化的问题?
问题描述
在sklearn的当前版本(v0.24)中,异常分数由函数计算_compute_score_samples
,点击这里:
def _compute_score_samples(self, X, subsample_features):
scores = 2 ** (
-depths
/ (len(self.estimators_)
* _average_path_length([self.max_samples_]))
)
return scores
但是,在 v0.19 中,单击此处此计算有所不同:
# https://github.com/scikit-learn/scikit-learn/blob/a24c8b46/sklearn/ensemble/iforest.py
scores = 2 ** (-depths.mean(axis=1) / _average_path_length(self.max_samples_))
现在,问题是:为什么 sklearn v0.24 计算depths/len(self.estimators_)
,而不是depths.mean(axis=1)
v0.19?
解决方案
推荐阅读
- amazon-web-services - GCP 防火墙问题 - 无法通过公共互联网访问特定端口
- javascript - 检查给定的字符串是否是同构的
- r - 更改 for 循环以应用参数
- python - Flask-ask AttributeError:模块'lib'没有属性'X509V3_EXT_get'
- java - 为什么我的 SPOJ 经典问题 5 超过了时间限制?
- c# - 从 Foreach 中的集合中删除单个元素
- c# - 如何使用 C# Asp.net 从我自己的 youtube 频道检索订阅者列表?
- javascript - ES6 对象用字符串传播
- python - Python SQLAlchemy获取匹配行和列相同的下一行
- r - grep and like when subsetting with parentheses