Exemplo n.º 1
0
        private void HexClick(object sender, PointerRoutedEventArgs e)
        {
            Polygon p = sender as Polygon;

            SOM.Node buf = p.Tag as SOM.Node;
            Debug.WriteLine($"{buf.Coordinate}, label = {buf.Label}, vector = {buf.WeightVector[0]}, {buf.WeightVector[1]}, {buf.WeightVector[2]}");
        }
Exemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //string map_size = cbx_map_size.SelectedValue.ToString();
            //int size = Convert.ToInt32(map_size);
            som           = new SOM();
            canvas.Height = som.Height * 32;
            canvas.Width  = som.Width * 32;
            double[] r = new double[3];
            r[0] = 1.0;
            r[1] = 0;
            r[2] = 0;
            SOM.Node rNode = new SOM.Node(3, vector: r, label: "R");

            double[] g = new double[3];
            g[0] = 0;
            g[1] = 1.0;
            g[2] = 0;
            SOM.Node gNode = new SOM.Node(3, vector: g, label: "G");

            double[] b = new double[3];
            b[0] = 0;
            b[1] = 0;
            b[2] = 1.0;
            SOM.Node bNode = new SOM.Node(3, vector: b, label: "B");

            double[] rg = new double[3];
            rg[0] = 1.0;
            rg[1] = 1.0;
            rg[2] = 0.0;
            SOM.Node rgNode = new SOM.Node(3, vector: rg, label: "RG");

            double[] rb = new double[3];
            rb[0] = 1.0;
            rb[1] = 0.0;
            rb[2] = 1.0;
            SOM.Node rbNode = new SOM.Node(3, vector: rb, label: "RB");

            double[] gb = new double[3];
            gb[0] = 0.0;
            gb[1] = 1.0;
            gb[2] = 1.0;
            SOM.Node gbNode = new SOM.Node(3, vector: gb, label: "GB");

            List <SOM.Node> nodes = new List <SOM.Node>();

            nodes.Add(rNode);
            nodes.Add(gNode);
            nodes.Add(bNode);
            nodes.Add(rgNode);
            nodes.Add(rbNode);
            nodes.Add(gbNode);
            som.Learning(nodes);
        }