public override void Compute()
        {
            var datasetsLocations = ReadDatasetsLocations();

            TLDatasetsList listOfDatasets = new TLDatasetsList();

            foreach (DatasetLocation locations in datasetsLocations)
            {
                TLDataset dataset = new TLDataset(locations.DatasetName);

                string error;

                //do validation
                if (CoestDatasetImporterHelper.ValidatePath(locations.SourceArtifactsLocation, "Source Artifacts File", out error))
                {
                    dataset.SourceArtifacts = CoestDatasetImporterHelper.ImportArtifacts(locations.SourceArtifactsLocation, m_config.TrimElementValues);
                    Logger.Info(String.Format("Source artifacts imported from {0}.", locations.SourceArtifactsLocation));
                }
                else
                {
                    throw new ComponentException(error);
                }

                //do validation
                if (CoestDatasetImporterHelper.ValidatePath(locations.SourceArtifactsLocation, "Target Artifacts File", out error))
                {
                    dataset.TargetArtifacts = CoestDatasetImporterHelper.ImportArtifacts(locations.TargetArtifactsLocation, m_config.TrimElementValues);
                    Logger.Info(String.Format("Target artifacts imported from {0}.", locations.TargetArtifactsLocation));
                }
                else
                {
                    throw new ComponentException(error);
                }

                //do validation
                if (CoestDatasetImporterHelper.ValidatePath(locations.SourceArtifactsLocation, "Target Artifacts File", out error))
                {
                    dataset.AnswerSet = CoestDatasetImporterHelper.ImportAnswerSet(locations.AnswerSetLocation, dataset.SourceArtifacts, locations.SourceArtifactsLocation, dataset.TargetArtifacts, locations.TargetArtifactsLocation, Logger, m_config.TrimElementValues);
                    Logger.Info(String.Format("Answer set imported from {0}.", locations.AnswerSetLocation));
                }
                else
                {
                    throw new ComponentException(error);
                }

                listOfDatasets.Add(dataset);
            }

            Workspace.Store("listOfDatasets", listOfDatasets);
            Workspace.Store("numberOfDatasets", listOfDatasets.Count);
        }
Exemple #2
0
        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);
        }
        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);
        }
        public override void Compute()
        {
            var datasetsLocations = ReadDatasetsLocations();

            TLDatasetsList listOfDatasets = new TLDatasetsList();

            foreach (DatasetLocation locations in datasetsLocations)
            {
                TLDataset dataset = new TLDataset(locations.DatasetName);

                string error;

                //do validation
                if (CoestDatasetImporterHelper.ValidatePath(locations.SourceArtifactsLocation, "Source Artifacts File", out error))
                {
                    dataset.SourceArtifacts = CoestDatasetImporterHelper.ImportArtifacts(locations.SourceArtifactsLocation, m_config.TrimElementValues);
                    Logger.Info(String.Format("Source artifacts imported from {0}.", locations.SourceArtifactsLocation));
                }
                else
                {
                    throw new ComponentException(error);
                }

                //do validation
                if (CoestDatasetImporterHelper.ValidatePath(locations.SourceArtifactsLocation, "Target Artifacts File", out error))
                {
                    dataset.TargetArtifacts = CoestDatasetImporterHelper.ImportArtifacts(locations.TargetArtifactsLocation, m_config.TrimElementValues);
                    Logger.Info(String.Format("Target artifacts imported from {0}.", locations.TargetArtifactsLocation));
                }
                else
                {
                    throw new ComponentException(error);
                }

                //do validation
                if (CoestDatasetImporterHelper.ValidatePath(locations.SourceArtifactsLocation, "Target Artifacts File", out error))
                {
                    dataset.AnswerSet = CoestDatasetImporterHelper.ImportAnswerSet(locations.AnswerSetLocation, dataset.SourceArtifacts, locations.SourceArtifactsLocation, dataset.TargetArtifacts, locations.TargetArtifactsLocation, Logger, m_config.TrimElementValues);
                    Logger.Info(String.Format("Answer set imported from {0}.", locations.AnswerSetLocation));
                }
                else
                {
                    throw new ComponentException(error);
                }

                listOfDatasets.Add(dataset);
            }

            Workspace.Store("listOfDatasets", listOfDatasets);
            Workspace.Store("numberOfDatasets", listOfDatasets.Count);
        }