public override void Compute() { List <string> map = (List <string>)Workspace.Load("DocumentMap"); TLSimilarityMatrix sims = Similarities.Import(_config.Directory.Absolute, map); Workspace.Store("Similarities", sims); }
public override void Compute() { int CurrentDataset = (int)Workspace.Load("CurrentDataset") - 1; List <ICSM11DataSet> datasets = (List <ICSM11DataSet>)Workspace.Load("ListOfDatasets"); Workspace.Store("RTM", Similarities.Import(datasets[CurrentDataset].PrecomputedRTMSimilarities)); }
public static void Run(ref Info info) { TLSimilarityMatrix vsm = Similarities.Import(info.ResultsDirectory + @"\CSMRTools\RoccoResults\EasyClinic UC-CC.VSM.sims"); TLSimilarityMatrix oracle = Oracle.Import(info.ResultsDirectory + @"\CSMRTools\RoccoResults\EasyClinic UC-CC.oracle"); TLSimilarityMatrix usage = Oracle.Import(info.ResultsDirectory + @"\CSMRTools\RoccoResults\EasyClinic UC-CC.relationships"); TLSimilarityMatrix udcsti = UDCSTI.Compute(vsm, usage, oracle); Similarities.Export(udcsti, info.ResultsDirectory + @"\CSMRTools\RoccoResults\EasyClinic UC-CC.VSM_UDCSTI.MYsims"); DataSetPairsCollection metrics = OverallMetricsComputation.ComputeAll(udcsti, oracle); TextWriter dataFile = File.CreateText(info.ResultsDirectory + @"\CSMRTools\RoccoResults\EasyClinic UC-CC.VSM_UDCSTI.MYsims.metrics"); for (int i = 0, j = 10; i < metrics.Count; i++, j += 10) { dataFile.WriteLine("{0} {1}", j, metrics[i].PrecisionData[0].Value); } dataFile.Flush(); dataFile.Close(); }
public void ComputeLSA() { TLArtifactsCollection source = TermDocumentMatrix.Load(@"../../Data/LSA/source.txt").ToTLArtifactsCollection(); TLArtifactsCollection target = TermDocumentMatrix.Load(@"../../Data/LSA/target.txt").ToTLArtifactsCollection(); REngine engine = new REngine(Settings.Default.RScriptEXE); TLSimilarityMatrix matrix = (TLSimilarityMatrix)engine.Execute(new LSAScript(source, target, new LSAConfig { Dimensions = 3 })); TLSimilarityMatrix correct = Similarities.Import(@"../../Data/LSA/correct.txt"); foreach (TLSingleLink link in matrix.AllLinks) { Assert.AreEqual(correct.GetScoreForLink(link.SourceArtifactId, link.TargetArtifactId), link.Score, Settings.Default.DoublePrecision ); } }
private static void WriteSims(ref Info info, CSMR13DataSet dataset, TLSimilarityMatrix oracle, string model) { TextWriter Output = File.CreateText(info.OutputDirectory + @"\CheckLinkOrder\" + SharedUtils.CleanFileName(dataset.Name) + "." + model + ".txt"); TLSimilarityMatrix sims = Similarities.Import(info.ResultsDirectory.FullName + @"\" + SharedUtils.CleanFileName(dataset.Name) + @"\sims\" + model + ".sims"); TLLinksList simList = sims.AllLinks; simList.Sort(); int pos = 1; foreach (TLSingleLink link in simList) { if (oracle.IsLinkAboveThreshold(link.SourceArtifactId, link.TargetArtifactId)) { Output.WriteLine("[{0}]\t{1}\t{2}\t{3}", pos, link.SourceArtifactId, link.TargetArtifactId, link.Score); } pos++; } Output.Flush(); Output.Close(); }
public void ComputeTest() { string data = @"../../Data/SimpleCorpus."; TLArtifactsCollection source = Artifacts.Import(data + "input.source.txt"); TLArtifactsCollection target = Artifacts.Import(data + "input.target.txt"); TLSimilarityMatrix testsims = VSM.Compute(source, target); TLSimilarityMatrix realsims = Similarities.Import(data + "output.VSM.txt"); Assert.AreEqual(testsims.Count, realsims.Count); TLLinksList testlinks = testsims.AllLinks; TLLinksList reallinks = realsims.AllLinks; testlinks.Sort(); reallinks.Sort(); for (int i = 0; i < reallinks.Count; i++) { Assert.AreEqual(testlinks[i].SourceArtifactId, reallinks[i].SourceArtifactId); Assert.AreEqual(testlinks[i].TargetArtifactId, reallinks[i].TargetArtifactId); Assert.AreEqual(testlinks[i].Score, reallinks[i].Score, 0.000000001); } }
public void BooleanQueriesAndTFIDFCorpusTest() { string inputData = Settings.Default.SimpleCorpusDir; string outputData = Path.Combine(inputData, "VSM"); TLArtifactsCollection source = Artifacts.ImportFile(Path.Combine(inputData, "source.txt")); TLArtifactsCollection target = Artifacts.ImportFile(Path.Combine(inputData, "target.txt")); TLSimilarityMatrix testsims = VSM.Compute(source, target, VSMWeightEnum.BooleanQueriesAndTFIDFCorpus); TLSimilarityMatrix realsims = Similarities.Import(Path.Combine(outputData, "output.txt")); Assert.AreEqual(testsims.Count, realsims.Count); TLLinksList testlinks = testsims.AllLinks; TLLinksList reallinks = realsims.AllLinks; testlinks.Sort(); reallinks.Sort(); for (int i = 0; i < reallinks.Count; i++) { Assert.AreEqual(testlinks[i].SourceArtifactId, reallinks[i].SourceArtifactId); Assert.AreEqual(testlinks[i].TargetArtifactId, reallinks[i].TargetArtifactId); Assert.AreEqual(testlinks[i].Score, reallinks[i].Score, Settings.Default.DoublePrecision); } }
public override void Compute() { Workspace.Store("Similarities", (TLSimilarityMatrix)Similarities.Import(_config.File.Absolute)); }
/// <summary> /// Import script results /// </summary> /// <param name="result">RScriptResults object</param> /// <returns>Script results</returns> public override object ImportResults(RScriptResult result) { return(Similarities.Import(_outputFile)); }