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

            categoryNode.addConnection(f2Neuron);
            categories.Add(categoryNode);
        }
Exemplo n.º 2
0
        public int getAssociatedCategory(F2Neuron f2Neuron)
        {
            int code = -1;

            if (f2Neuron.getMapFieldConnection() != null)
            {
                code = f2Neuron.getMapFieldConnection().getCategory().getCode();
            }
            return(code);
        }
Exemplo n.º 3
0
        public int AddF2Neuron(LayerF1 f1Layer, double[] tdConnWeights, double [] prototype) // to be called from CAFuzzyART(string path) method where pattern != tdConnweights
        {
            F2Neuron newF2Neuron = new F2Neuron(f1Layer.Count);

            base.Add(newF2Neuron);
            SynapticConnection[] connections = newF2Neuron.getConnections();
            for (int i = 0; i < connections.Length; i++)
            {
                connections[i].setF1Neuron((F1Neuron)f1Layer[i]);
                connections[i].setF2Neuron(newF2Neuron);
                ((F1Neuron)f1Layer[i]).AddSynapticConnection(connections[i]);
                connections[i].setWeight(tdConnWeights[i]);
            }
            newF2Neuron.setProtoTypeCluster(prototype);
            return(base.Count - 1);
        }
Exemplo n.º 4
0
        public MapFieldCategory recallCat(int contextCode, double[] Pattern) //THIS METHOD ASSUMES THAT EACH F2 NODE IS CONNECTED WITH ONLY ONE MAPFIELD NODE
        {
            ARTModule.reSetRho(rho);
            LayerF2 contextNeurons = (LayerF2)ARTModule.contextField[contextCode];

            object[,] artCluster = ARTModule.getCluster(contextCode, Pattern);
            if ((int)artCluster[0, 1] == -1)
            {
                return(null);
            }
            else
            {
                F2Neuron           f2Neuron = (F2Neuron)contextNeurons[(int)artCluster[0, 1]];
                MapFieldConnection mfConn   = f2Neuron.getMapFieldConnection();
                return(mfConn.getCategory());
            }
        }
Exemplo n.º 5
0
        //public int recall(int contextCode, double[] Pattern) // THIS METHOD ASSUMES THAT EACH F2 NODE HAS CONNECTIONS WITH ALL MAPFIELD NODES
        //{
        //    ARTModule.reSetRho(rho);
        //    int code = -1; // Don't Know
        //    LayerF2 contextNeurons = (LayerF2)ARTModule.contextField[contextCode];
        //    object [,]artCluster = ARTModule.getCluster(contextCode, Pattern);
        //    if ((int)artCluster[0, 1] == -1)
        //        code = -1;
        //    else
        //    {
        //        F2Neuron f2Neuron = (F2Neuron)contextNeurons[(int)artCluster[0, 1]];
        //        f2Neuron.getMapFieldConnections();
        //        ArrayList mapFieldConnections = f2Neuron.getMapFieldConnections();
        //        IEnumerator mapFieldConnEnum = mapFieldConnections.GetEnumerator();
        //        while (mapFieldConnEnum.MoveNext())
        //        {
        //            MapFieldConnection mapFieldConn = (MapFieldConnection)mapFieldConnEnum.Current;
        //            if (mapFieldConn.getWeight() == 1)
        //            {
        //                MapFieldCategory category = mapFieldConn.getCategory();
        //                code = category.getCode();
        //                //break;
        //            }
        //        }
        //    }
        //       // code = mapField.getAssociatedCategory(contextNeurons, (int)artCluster[0, 1]);
        //    return code;
        //}
        public int recall(int contextCode, double[] Pattern) //THIS METHOD ASSUMES THAT EACH F2 NODE IS CONNECTED WITH ONLY ONE MAPFIELD NODE
        {
            ARTModule.reSetRho(rho);
            int     code           = -1; // Don't Know
            LayerF2 contextNeurons = (LayerF2)ARTModule.contextField[contextCode];

            object[,] artCluster = ARTModule.getCluster(contextCode, Pattern);
            if ((int)artCluster[0, 1] == -1)
            {
                code = -1;
            }
            else
            {
                F2Neuron           f2Neuron = (F2Neuron)contextNeurons[(int)artCluster[0, 1]];
                MapFieldConnection mfConn   = f2Neuron.getMapFieldConnection();
                MapFieldCategory   category = mfConn.getCategory();
                code = category.getCode();
            }
            // code = mapField.getAssociatedCategory(contextNeurons, (int)artCluster[0, 1]);
            return(code);
        }
Exemplo n.º 6
0
        public double[] processInput(double[] i, double alpha, LayerF2 F2Neurons) // Orienting Subsystem
        {
            int f2index = 0;

            double[] f1Output = new double[F2Neurons.Count];
            while (f2index < F2Neurons.Count)
            {
                F2Neuron f2Neuron     = (F2Neuron)F2Neurons[f2index];
                int      f1index      = 0;
                double[] z            = new double[i.Length];
                double   I_FuzzyAND_Z = 0.0;
                while (f1index < base.Count)
                {
                    z[f1index]    = f2Neuron.getWeight(f1index);
                    I_FuzzyAND_Z += Math.Min(z[f1index], i[f1index]);
                    f1index++;
                }
                f1Output[f2index++] = Math.Round((I_FuzzyAND_Z / (alpha + norm(z))), 4);
            }
            return(f1Output);
        }
Exemplo n.º 7
0
 public void setF2Neuron(F2Neuron f2Neuron)
 {
     this.f2Neuron = f2Neuron;
 }
Exemplo n.º 8
0
 public SynapticConnection(F2Neuron f2Neuron, F1Neuron f1Neuron)
 {
     this.f1Neuron = f1Neuron;
     this.f2Neuron = f2Neuron;
 }