19 using TraceLabSDK.Types;
20 using TraceLabSDK.Types.Contests;
22 namespace TraceLab.Components.DevelopmentKit.Metrics.Traceability
31 private const string _name =
"Precision (ranklist granularity)";
32 private const string _description =
"Precision measures the fraction of correctly retrieved documents among the retrieved documents. This metric is computed on the overall ranked list.";
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 _oracle.Threshold = 0;
74 foreach (TLSingleLink link
in _matrix.AllLinks)
76 if (_oracle.IsLinkAboveThreshold(link.SourceArtifactId, link.TargetArtifactId))
81 Results =
new SerializableDictionary<string, double>();
82 Results.Add(
"Precision", correct / (
double)_matrix.Count);
91 BoxSummaryData data =
new BoxSummaryData(Name, Description);
92 data.AddPoint(
new BoxPlotPoint(Results.Values.ToArray()));