19 using TraceLabSDK.Types;
20 using TraceLabSDK.Types.Contests;
22 namespace TraceLab.Components.DevelopmentKit.Metrics.Traceability
31 private const string _name =
"Recall (query granularity)";
32 private const string _description =
"Recall measures the fraction of correctly retrieved documents among the total correct documents. This metric is calculated per source artifact.";
37 public override string Name
45 public override string Description
47 get {
return _description; }
50 private TLSimilarityMatrix _matrix;
51 private TLSimilarityMatrix _oracle;
63 _matrix = candidateMatrix;
64 _oracle = answerMatrix;
72 SerializableDictionary<string, double> sourceRecall =
new SerializableDictionary<string, double>();
73 _oracle.Threshold = 0;
74 foreach (
string sourceArtifact
in _oracle.SourceArtifactsIds)
76 TLLinksList links = _matrix.GetLinksAboveThresholdForSourceArtifact(sourceArtifact);
78 foreach (TLSingleLink link
in links)
80 if (_oracle.IsLinkAboveThreshold(link.SourceArtifactId, link.TargetArtifactId))
85 sourceRecall.Add(sourceArtifact, correct / (
double) _oracle.GetCountOfLinksAboveThresholdForSourceArtifact(sourceArtifact));
87 Results = sourceRecall;
96 BoxSummaryData data =
new BoxSummaryData(Name, Description);
97 data.AddPoint(
new BoxPlotPoint(Results.Values.ToArray()));