alibaba / alibaba/Alink

IForestOutlierBatchOp进行异常检测时,输出结果顺序颠倒

Open
#231 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.6k
Forks
780
PR merge metrics
No merged PRs in 30d

Description

`

String[] FEATURE_NAMES = {"f1", "f2", "f3", "f4", "f5",
"f6", "f7", "f8", "f9"};
String[] ALL_NAMES = {"f1", "f2", "f3", "f4", "f5",
"f6", "f7", "f8", "f9", "label"};
BatchOperator data = new MemSourceBatchOp(
new Object[][] {
{10, 10, 10, 10, 10, 10, 10, 10, 10, 0},
{10, 10, 10, 10, 10, 10, 10, 10, 10, 0},
{10, 10, 10, 10, 10, 10, 10, 10, 10, 0},
{10, 10, 10, 10, 10, 10, 10, 10, 10, 0},
{10, 10, 10, 10, 10, 10, 10, 10, 10, 0},
{1, 1, 1, 1, 1, 1, 1, 1, 100, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 200, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 300, 1},
},
ALL_NAMES);
BatchOperator outlier = new IForestOutlierBatchOp()
.setFeatureCols(FEATURE_NAMES)
.setPredictionCol("pred")
.setPredictionDetailCol("pred_detail");
data.link(outlier).print();

`
的运行结果为:

f1 |f2 |f3 |f4 |f5 |f6 |f7 |f8 |f9 |label|pred|pred_detail
---|---|---|---|---|---|---|---|---|-----|----|-----------
10|10|10|10|10|10|10|10|10|0|true|{"outlier_score":"0.5907573613555553","is_outlier":"true"}
10|10|10|10|10|10|10|10|10|0|true|{"outlier_score":"0.5496377996962295","is_outlier":"true"}
10|10|10|10|10|10|10|10|10|0|true|{"outlier_score":"0.5988412960965512","is_outlier":"true"}
10|10|10|10|10|10|10|10|10|0|false|{"outlier_score":"0.48774601295119835","is_outlier":"false"}
10|10|10|10|10|10|10|10|10|0|false|{"outlier_score":"0.48774601295119835","is_outlier":"false"}
1|1|1|1|1|1|1|1|100|1|false|{"outlier_score":"0.48774601295119835","is_outlier":"false"}
1|1|1|1|1|1|1|1|200|1|false|{"outlier_score":"0.48774601295119835","is_outlier":"false"}
1|1|1|1|1|1|1|1|300|1|false|{"outlier_score":"0.48774601295119835","is_outlier":"false"}

后三行的结果跑到前三行中

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the IForestOutlierBatchOp entry point and reproduce the ordering problem with the Java example and data shown in the issue. Trace how prediction results are joined back to the input rows, then verify that pred and pred_detail remain aligned with their original rows and run the relevant existing tests, if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.