public void Run() { DateTime expSt = DateTime.Now; Console.WriteLine("========================================================================"); Console.WriteLine(" Metoda porównania: " + comparators[comparatorId].GetType()); Console.WriteLine("========================================================================"); WordsStats stats = new WordsStats(Words.ComputeWords(DataStore.Instance.GetAllNews())); stats.Compute(); List <string> experimentTopics; if (topics != null) { experimentTopics = new List <string>(); experimentTopics.AddRange(topics); } else { experimentTopics = GetRandomTopics(topicCount); } Group initialGroup = GroupFactory.CreateGroupWithNewsFromTopics(experimentTopics); Console.WriteLine("========================================================================"); Console.WriteLine("Topiki w grupie początkowej:"); foreach (string topic in experimentTopics) { Console.WriteLine(topic + " [" + Util.topicCountInGroup(topic, initialGroup) + "]"); } Console.WriteLine("Rozmiar grupy: " + initialGroup.Count); ; DateTime start; TimeSpan t1, t2; Hierarchical hr = new Hierarchical(comparators[comparatorId], stats, maxLen); Kmeans km = new Kmeans(comparators[comparatorId], stats, maxLen); Console.WriteLine("========================================================================"); if (!onlyKMeans) { start = DateTime.Now; List <Group> hierarchicalResult = hr.Compute(initialGroup, topicCount != 0 ? topicCount : (uint)topics.Length, Hierarchical.Distance.AVG); t1 = (DateTime.Now - start); PrintStats("Hierachical", t1, hierarchicalResult, 0); } start = DateTime.Now; List <Group> kMeansResult = km.Compute(initialGroup, topicCount != 0 ? topicCount : (uint)topics.Length, kMeansIterations); t2 = (DateTime.Now - start); PrintStats("KMeans", t2, kMeansResult, kMeansIterations); Console.WriteLine("========================================================================"); Console.WriteLine("Czas działania: " + (DateTime.Now - expSt)); }
public void ComputeTest() { List <Pointer> pointers = new List <Pointer>() { new Pointer() { X = 1, Y = 21, Z = 0 }, new Pointer() { X = 12, Y = 23, Z = 0 }, new Pointer() { X = 10, Y = 2, Z = 0 }, new Pointer() { X = 3, Y = 10, Z = 0 }, new Pointer() { X = 13, Y = 12, Z = 0 }, new Pointer() { X = 4, Y = 15, Z = 0 }, new Pointer() { X = 9, Y = 6, Z = 0 }, new Pointer() { X = 21, Y = 8, Z = 0 }, new Pointer() { X = 11, Y = 6, Z = 0 }, new Pointer() { X = 21, Y = 9, Z = 0 }, new Pointer() { X = 13, Y = 6, Z = 0 }, new Pointer() { X = 20, Y = 19, Z = 0 }, new Pointer() { X = 20, Y = 19, Z = 0 }, new Pointer() { X = 1, Y = 21, Z = 0 }, new Pointer() { X = 12, Y = 23, Z = 0 }, new Pointer() { X = 10, Y = 2, Z = 0 }, new Pointer() { X = 3, Y = 10, Z = 0 }, new Pointer() { X = 13, Y = 12, Z = 0 }, new Pointer() { X = 4, Y = 15, Z = 0 }, new Pointer() { X = 9, Y = 6, Z = 0 }, new Pointer() { X = 21, Y = 8, Z = 0 }, new Pointer() { X = 11, Y = 6, Z = 0 }, new Pointer() { X = 21, Y = 9, Z = 0 }, new Pointer() { X = 13, Y = 6, Z = 0 }, new Pointer() { X = 20, Y = 19, Z = 0 }, new Pointer() { X = 20, Y = 19, Z = 0 }, }; Hierarchical kmeans = new Hierarchical(pointers); kmeans.Compute(3); }