Class AccuracyEvaluator
AccuracyMetrics.
Ground truth
The labels are a ClassificationOverride document: the same
human-reviewed YAML that -override-file applies to scans. Resolution
follows the override rules: a method-level entry wins over a class-level entry
for the same class, and the last duplicate wins. An entry yields:
- a relevance label when
securityRelevantis present; - a tag label when
tagsis present, or — as a deliberate convention — an empty tag set whensecurityRelevant: falseis present without tags (a reviewer who says "not security-relevant" asserts that no security tag applies).securityRelevant: truewithouttagslabels relevance only.
An entry that carries neither (for example a note-only entry) is not a
label and is ignored.
Predictions
Predictions are the ai_security_relevant and ai_tags columns of
a MethodAtlas scan CSV produced with -ai. The scan used to produce them
must not have been run with -override-file: overrides replace
the AI values and would make the evaluation score the human's labels against
themselves.
Coverage bookkeeping
Missing and extra entries never fail the evaluation; they are counted and
reported so that a reader can judge how representative the numbers are:
predictions without a label (AccuracyEvaluator.Evaluation.unlabelledPredictions()),
labelled methods without an AI prediction
(AccuracyEvaluator.Evaluation.unpredictedLabels()), and label entries that match no
scanned method or class (AccuracyEvaluator.Evaluation.staleLabelEntries()).
This class is stateless and thread-safe.
- Since:
- 6.1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordMetrics together with the coverage bookkeeping of the join. -
Method Summary
Modifier and TypeMethodDescriptionstatic AccuracyEvaluator.EvaluationLoads the label file and the predictions CSV and evaluates them.static AccuracyEvaluator.Evaluationevaluate(org.egothor.methodatlas.emit.ClassificationOverride labels, List<org.egothor.methodatlas.api.ScanRecord> predictions) Evaluates already-loaded labels against already-loaded predictions.
-
Method Details
-
evaluate
public static AccuracyEvaluator.Evaluation evaluate(Path labelsFile, Path predictionsCsv) throws IOException Loads the label file and the predictions CSV and evaluates them.- Parameters:
labelsFile- override-format YAML holding the human-reviewed labels; must existpredictionsCsv- MethodAtlas scan CSV produced with-ai- Returns:
- the evaluation; never
null - Throws:
IOException- if either file cannot be read or parsedIllegalArgumentException- if the CSV lacks the requiredfqcnormethodcolumns
-
evaluate
public static AccuracyEvaluator.Evaluation evaluate(org.egothor.methodatlas.emit.ClassificationOverride labels, List<org.egothor.methodatlas.api.ScanRecord> predictions) Evaluates already-loaded labels against already-loaded predictions.- Parameters:
labels- human-reviewed labels; must not benullpredictions- scan records carrying the AI columns; must not benull- Returns:
- the evaluation; never
null
-