Ejemplo n.º 1
0
        public void addNewCategory(F2Neuron f2Neuron, string categoryName, int code)
        {
            MapFieldCategory categoryNode = new MapFieldCategory(categoryName, code);

            categoryNode.addConnection(f2Neuron);
            categories.Add(categoryNode);
        }
Ejemplo n.º 2
0
        public int learn(int contextCode, double[] Pattern, int categoryCode, string categoryName)
        {
            if (!mapField.categoryExists(categoryCode))
            {
                mapField.addNewCategory(categoryName, categoryCode);
            }
            // Initialize Rho with System Rho
            ARTModule.reSetRho(rho);

            double rhoInc = 0.0;

Repeater:
            rhoInc += rhoIncrement;
            int f2NeuronCountBefore = 0;

            ConSelFAM.NET.LayerF2 f2Neurons = (ConSelFAM.NET.LayerF2)ARTModule.contextField[contextCode]; // just to initialize
            //load context
            if (ARTModule.contextField.ContainsKey(contextCode))
            {
                f2Neurons           = (ConSelFAM.NET.LayerF2)ARTModule.contextField[contextCode];
                f2NeuronCountBefore = f2Neurons.Count;
            }
            object [,] artCluster = ARTModule.feedInput(contextCode, Pattern, categoryCode);
            int J = (int)artCluster[0, 1];

            double[] ZJ = (double[])artCluster[0, 0];

            f2Neurons = (ConSelFAM.NET.LayerF2)ARTModule.contextField[contextCode];
            int f2NeuronCountAfter = f2Neurons.Count;


            if (f2NeuronCountBefore != f2NeuronCountAfter)
            {
                // THIS MEANS THAT NEW F2 NEURON IS ADDED TO THIS CONTEXT
                MapFieldCategory cat = mapField.getCategory(categoryCode);
                cat.addConnection(((F2Neuron)f2Neurons[J]));
            }

            return(mapField.getAssociatedCategory((F2Neuron)f2Neurons[J]));
        }