private void AprioriTid(IFormFile newFile) { int Support = 2; if (newFile != null && newFile.Length > 0) { using (var tr = new System.IO.StreamReader(newFile.OpenReadStream())) { while ((line = tr.ReadLine()) != null) { line.Replace("\t", "#"); lines.Add(line); } } } else { } List <BAL.ItemSet> tableitemset = GetitemList(lines.ToList()); // Fill table of items newList = tableitemset; // write to new file new candiaties string docPath = Path.Combine(_hostEnvironment.WebRootPath, "File"); // Write the string array to a new file named "WriteLines.txt". using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "TempFile.txt"))) { foreach (ItemSet line in tableitemset) { outputFile.WriteLine(line.Label); } } BAL.Apriori apriori = new Apriori(Path.Combine(docPath, "TempFile.txt")); int k = 1; List <BAL.ItemSet> ItemSets = new List <BAL.ItemSet>(); // BAL.Apriori aprioriTid = new BAL.Apriori(tableitemset.ToList()); bool next; do { next = false; var L = apriori.GetItemSet(k, Support, IsFirstItemList: k == 1); if (L.Count > 0) { List <AssociationRule> rules = new List <AssociationRule>(); if (k != 1) { rules = apriori.GetRules(L); } // TableUserControl tableL = new TableUserControl(L, rules); _LList.Add(new BAL.ItemSet() { Support = 0, Label = "L" + k }); TableUserControl(L, rules); next = true; k++; ItemSets.Add(L); } } while (next); }