#8351·fiftyone

[BUG] 代表性被硬编码为"本地"正则化

作者: tigmoore创建于 2026年8月26日更新于 2026年8月26日
标签bug

""" Minimal reproduction: fiftyone.brain.compute_representativeness() (method="cluster-center", the default) returns values with inverted semantics. The field is documented/named as "representativeness": high value = sample is close to a cluster center = typical/representative. In practice, the value returned is the sample's distance to its cluster center, normalized within that cluster -- i.e. an outlier score, not a representativeness score. A sample sitting exactly on its cluster's center gets a value near 0; a sample at the far edge of its cluster gets a value near 1. Root cause (traced in fiftyone/brain/internal/core/representativeness.py, function _cluster_ranker, lines ~186-231): centerness_ranking = 1 / (1 + sample_dists) # correct: high = central norm_method = "local" # hardcoded, ignores the norm_method arg if norm_method == "global": centerness_ranking = centerness_ranking / centerness_ranking.max() elif norm_method == "local": for unique_id in unique_ids: cluster_indices = np.where(cluster_ids == unique_id)[0] cluster_dists = sample_dists[cluster_indices] cluster_dists /= cluster_dists.max() sample_dists[cluster_indices] = cluster_dists centerness_ranking = sample_dists # <-- overwrites centerness with normalized raw distance norm_method is hardcoded on the line right before the branch, so the "global" branch is

内容来源: voxel51/fiftyone