public override void Compute() { //load dataset from workspace TLDatasetsList datasets = (TLDatasetsList)Workspace.Load("datasets"); TLSimilarityMatricesCollection resultSimilarityMatrices = (TLSimilarityMatricesCollection)Workspace.Load("resultSimilarityMatrices"); //wrap result similarity matrix into TracingResult var tracingResults = Adapt(resultSimilarityMatrices, "Current technique"); MetricComputationEngine engine = new MetricComputationEngine(datasets, Logger, m_config); engine.AddTracingResults(tracingResults); TLExperimentsResultsCollection allExperimentResults = engine.ComputeResults(); //set base data from which all metrics were computed from allExperimentResults["Current technique"].BaseData = resultSimilarityMatrices; //check if baseline results are in the workspace var baseline = (TLExperimentResults)Workspace.Load("BASELINE"); if (baseline != null) { //if so, add them to collection of experiment results, so that it can be viewed by GUI component allExperimentResults.Add(baseline); TLSimilarityMatricesCollection baselineMatrices = baseline.BaseData as TLSimilarityMatricesCollection; //compute the score allExperimentResults["Current technique"].Score = ScoreComputation.ComputeScore(baselineMatrices, resultSimilarityMatrices, datasets, m_config); } else { allExperimentResults["Current technique"].Score = 0.0; } Workspace.Store("comparedResults", allExperimentResults); Workspace.Store("currentResults", allExperimentResults["Current technique"]); }
public override void Compute() { // Loading artifacts & datasets from workspace TLArtifactsCollection sourceArtifacts = (TLArtifactsCollection)Workspace.Load("sourceArtifacts"); TLArtifactsCollection targetArtifacts = (TLArtifactsCollection)Workspace.Load("targetArtifacts"); TLSimilarityMatrix answerMatrix = (TLSimilarityMatrix)Workspace.Load("answerMatrix"); TLSimilarityMatrix similarityMatrix = (TLSimilarityMatrix)Workspace.Load("similarityMatrix"); // Checking for null arguments if (sourceArtifacts == null) { throw new ComponentException("The loaded source artifacts cannot be null!"); } if (targetArtifacts == null) { throw new ComponentException("The loaded target artifacts cannot be null!"); } if (answerMatrix == null) { throw new ComponentException("The loaded answer matrix cannot be null!"); } if (similarityMatrix == null) { throw new ComponentException("The loaded similarity matrix cannot be null!"); } // Results calculation TLDatasetsList datasets = new TLDatasetsList(); var dataset = new TLDataset("Experiment results"); dataset.AnswerSet = answerMatrix; dataset.SourceArtifacts = sourceArtifacts; dataset.TargetArtifacts = targetArtifacts; datasets.Add(dataset); TLSimilarityMatricesCollection similarityMatrices = new TLSimilarityMatricesCollection(); similarityMatrix.Name = "Experiment results"; similarityMatrices.Add(similarityMatrix); MetricComputationEngine engine = new MetricComputationEngine(datasets, Logger, m_config); //wrap result similarity matrix into TracingResult var tracingResults = GroupOfTracingResults<SingleTracingResults>.Adapt(similarityMatrices, "Experiment results"); engine.AddTracingResults(tracingResults); var results = engine.ComputeResults(); // Store the results in the workspace Workspace.Store("results", results); }