/// <summary> /// Som neural network, circle of neurons topology, torus data /// </summary> private void TorusStartButton_Click(object sender, System.Windows.RoutedEventArgs e) { // prepare the data - create a torus var data = new List<double[]>(); const int radiousFromCanvasCenter = 40; const int torusRadious = 10; for (var i = 0; i < 360; i = i + 3) for (var j = 0; j < 360; j = j +3) { double radians1 = i/(180/Math.PI); double radians2 = j/(180/Math.PI); double x = (radiousFromCanvasCenter + torusRadious * Math.Cos(radians1)) * Math.Cos(radians2); double y = (radiousFromCanvasCenter + torusRadious * Math.Cos(radians1)) * Math.Sin(radians2); data.Add(new []{x + 50 ,y + 50}); } // Initialize Self Orgenized map var selfOrgenizedMap = new SelfOrgnizedMap<CircleTopology>(2, int.Parse(SetNumOfClasters.Text), this); StartWorking(data.ToArray(), selfOrgenizedMap); }
/// <summary> /// Som neural network , line of neurons topology, uniform density data /// </summary> private void UnifromStartButton_Click(object sender, System.Windows.RoutedEventArgs e) { // prepare the data - ordered data var dataSize = (int)(MainCanvas.Height * MainCanvas.Width); var data = new double[dataSize][]; for (var i = 0; i < MainCanvas.Height; i++) for (var j = 0; j < MainCanvas.Width; j++) { data[(i * ((int)MainCanvas.Width)) + j] = new double[] { i, j }; } // Initialize Self Orgenized map var selfOrgenizedMap = new SelfOrgnizedMap<LineTopology>(2, int.Parse(SetNumOfClasters.Text), this); StartWorking(data, selfOrgenizedMap); }
/// <summary> /// Som neural network, line of neurons topology, non uniform density data /// </summary> private void NonUniformStartButton_Click(object sender, System.Windows.RoutedEventArgs e) { var rand = new Random(); // prepare the data - random data var dataSize = (int)(MainCanvas.Height * MainCanvas.Width); var data = new double[dataSize][]; for (var i = 0; i < MainCanvas.Height; i++) { var x = rand.Next(0,(int)MainCanvas.Width); var y = rand.Next(0,(int)MainCanvas.Height); for (var j = 0; j < MainCanvas.Height; j++) data[(i * ((int)MainCanvas.Width)) + j] = new [] { rand.Next(x-5,x+5), (double)rand.Next(y - 5, y +5) }; } // Initialize Self Orgenized map var selfOrgenizedMap = new SelfOrgnizedMap<LineTopology>(2, int.Parse(SetNumOfClasters.Text), this); StartWorking(data, selfOrgenizedMap); }