public BoxSummaryData Calculate(SingleTracingResults singleTechniqueResults, TLDataset dataset) { SortedDictionary<string, double> intermediateResults = m_metricComputation.Calculate(singleTechniqueResults.ResultMatrix, dataset); double[] dataPoints = intermediateResults.Values.ToArray(); if (dataPoints.Length == 0 && m_logger != null) { m_logger.Warn("Metric computation of '" + m_metricName + "' returned zero matching results for " + dataset.Name + " for one of the techniques. It may be valid results, but it may also mean that there is mismatch of ids in the answer matrix and corresponding artifacts." ); } var summaryData = new BoxSummaryData(m_metricName, m_metricDescription); summaryData.AddPoint(new BoxPlotPoint(dataPoints)); return summaryData; }
/// <summary> /// Generates a summarizing Metric for results analysis /// </summary> /// <returns>Metric object</returns> protected override Metric GenerateSummaryImplementation() { BoxSummaryData data = new BoxSummaryData(Name, Description); data.AddPoint(new BoxPlotPoint(Results.Values.ToArray())); return data; }
public void ExperimentResultsRawSerializationTest() { int n = 0; TLExperimentResults expResultsIn = new TLExperimentResults("Technique " + n++); for (int k = 0; k < 5; k++) { DatasetResults dataResults = new DatasetResults("Dataset " + n++); for (int i = 0; i < 10; i++) { LineSeries line = new LineSeries("Line " + i, "Description " + n++); for (int j = 1000 * i; j < 1000; j++) { line.AddPoint(new Point(j, j + 1)); } dataResults.AddMetric(line); BoxSummaryData box = new BoxSummaryData("Box " + i, "Description " + n++); for (int j = 0; j < 100; j++) { box.AddPoint(new BoxPlotPoint(j, j + 1, j + 2, j + 3, j + 4, j + 5, j + 6, j + 7)); } dataResults.AddMetric(box); } expResultsIn.AddDatasetResult(dataResults); } BinaryWriter binWriter = new BinaryWriter(new MemoryStream()); BinaryReader binReader = new BinaryReader(binWriter.BaseStream); expResultsIn.WriteData(binWriter); binReader.BaseStream.Position = 0; TLExperimentResults expResultsOut = (TLExperimentResults)Activator.CreateInstance(typeof(TLExperimentResults), true); expResultsOut.ReadData(binReader); Assert.AreEqual(expResultsIn.TechniqueName, expResultsOut.TechniqueName); Assert.AreEqual(expResultsIn.DatasetsResults.Count(), expResultsOut.DatasetsResults.Count()); foreach (DatasetResults result1 in expResultsIn.DatasetsResults) { bool sameDatasetResultExists = false; DatasetResults result2 = null; foreach (DatasetResults res in expResultsOut.DatasetsResults) { if (res.DatasetName == result1.DatasetName) { sameDatasetResultExists = true; result2 = res; break; } } Assert.IsTrue(sameDatasetResultExists); Assert.AreEqual(result1.DatasetName, result2.DatasetName); Assert.AreEqual(result1.Metrics.Count(), result2.Metrics.Count()); foreach (Metric m1 in result1.Metrics) { bool sameMetricExists = false; Metric m2 = null; foreach (Metric metric in result2.Metrics) { if (m1.MetricName == metric.MetricName) { sameMetricExists = true; m2 = metric; break; } } Assert.IsTrue(sameMetricExists); Assert.AreEqual(m1.Description, m2.Description); if (m1 is LineSeries) { Assert.IsTrue(m2 is LineSeries); LineSeries l1 = (LineSeries)m1; LineSeries l2 = (LineSeries)m2; Assert.AreEqual(l1.Points.Count(), l2.Points.Count()); } else { Assert.IsTrue(m2 is BoxSummaryData); BoxSummaryData b1 = (BoxSummaryData)m1; BoxSummaryData b2 = (BoxSummaryData)m2; Assert.AreEqual(b1.Points.Count(), b2.Points.Count()); } } } }