Наследование: BasicART, IMLResettable, IMLClassification
Пример #1
0
 private ART1 Create()
 {
     var network = new ART1(6, 3);
     network.WeightsF1ToF2[1, 1] = 2.0;
     network.WeightsF2ToF1[2, 2] = 3.0;
     return network;
 }
Пример #2
0
 private void Validate(ART1 network)
 {
     Assert.AreEqual(6, network.F1Count);
     Assert.AreEqual(3, network.F2Count);
     Assert.AreEqual(18, network.WeightsF1ToF2.Size);
     Assert.AreEqual(18, network.WeightsF2ToF1.Size);
     Assert.AreEqual(2.0, network.WeightsF1ToF2[1, 1]);
     Assert.AreEqual(3.0, network.WeightsF2ToF1[2, 2]);
     Assert.AreEqual(1.0, network.A1);
     Assert.AreEqual(1.5, network.B1);
     Assert.AreEqual(5.0, network.C1);
     Assert.AreEqual(0.9, network.D1);
     Assert.AreEqual(0.9, network.Vigilance);
 }
Пример #3
0
        /// <inheritdoc/>
        public Object Read(Stream mask0)
        {
            var result = new ART1();
            var ins0 = new EncogReadHelper(mask0);
            EncogFileSection section;

            while ((section = ins0.ReadNextSection()) != null)
            {
                if (section.SectionName.Equals("ART1")
                    && section.SubSectionName.Equals("PARAMS"))
                {
                    IDictionary<String, String> paras = section.ParseParams();
                    EngineArray.PutAll(paras, result.Properties);
                }
                if (section.SectionName.Equals("ART1")
                    && section.SubSectionName.Equals("NETWORK"))
                {
                    IDictionary<String, String> p = section.ParseParams();

                    result.A1 = EncogFileSection.ParseDouble(p,
                                                             BasicART.PropertyA1);
                    result.B1 = EncogFileSection.ParseDouble(p,
                                                             BasicART.PropertyB1);
                    result.C1 = EncogFileSection.ParseDouble(p,
                                                             BasicART.PropertyC1);
                    result.D1 = EncogFileSection.ParseDouble(p,
                                                             BasicART.PropertyD1);
                    result.F1Count = EncogFileSection.ParseInt(p,
                                                               PersistConst.PropertyF1Count);
                    result.F2Count = EncogFileSection.ParseInt(p,
                                                               PersistConst.PropertyF2Count);
                    result.NoWinner = EncogFileSection.ParseInt(p,
                                                                BasicART.PropertyNoWinner);
                    result.L = EncogFileSection
                        .ParseDouble(p, BasicART.PropertyL);
                    result.Vigilance = EncogFileSection.ParseDouble(p,
                                                                    BasicART.PropertyVigilance);
                    result.WeightsF1ToF2 = EncogFileSection.ParseMatrix(p,
                                                                        PersistConst.PropertyWeightsF1F2);
                    result.WeightsF2ToF1 = EncogFileSection.ParseMatrix(p,
                                                                        PersistConst.PropertyWeightsF2F1);
                }
            }

            return result;
        }
Пример #4
0
        /// <inheritdoc/>
        public Object Read(Stream mask0)
        {
            var result = new ART1();
            var ins0   = new EncogReadHelper(mask0);
            EncogFileSection section;

            while ((section = ins0.ReadNextSection()) != null)
            {
                if (section.SectionName.Equals("ART1") &&
                    section.SubSectionName.Equals("PARAMS"))
                {
                    IDictionary <String, String> paras = section.ParseParams();
                    EngineArray.PutAll(paras, result.Properties);
                }
                if (section.SectionName.Equals("ART1") &&
                    section.SubSectionName.Equals("NETWORK"))
                {
                    IDictionary <String, String> p = section.ParseParams();

                    result.A1 = EncogFileSection.ParseDouble(p,
                                                             BasicART.PropertyA1);
                    result.B1 = EncogFileSection.ParseDouble(p,
                                                             BasicART.PropertyB1);
                    result.C1 = EncogFileSection.ParseDouble(p,
                                                             BasicART.PropertyC1);
                    result.D1 = EncogFileSection.ParseDouble(p,
                                                             BasicART.PropertyD1);
                    result.F1Count = EncogFileSection.ParseInt(p,
                                                               PersistConst.PropertyF1Count);
                    result.F2Count = EncogFileSection.ParseInt(p,
                                                               PersistConst.PropertyF2Count);
                    result.NoWinner = EncogFileSection.ParseInt(p,
                                                                BasicART.PropertyNoWinner);
                    result.L = EncogFileSection
                               .ParseDouble(p, BasicART.PropertyL);
                    result.Vigilance = EncogFileSection.ParseDouble(p,
                                                                    BasicART.PropertyVigilance);
                    result.WeightsF1ToF2 = EncogFileSection.ParseMatrix(p,
                                                                        PersistConst.PropertyWeightsF1F2);
                    result.WeightsF2ToF1 = EncogFileSection.ParseMatrix(p,
                                                                        PersistConst.PropertyWeightsF2F1);
                }
            }

            return(result);
        }
Пример #5
0
 public object Read(Stream mask0)
 {
     EncogReadHelper helper;
     EncogFileSection section;
     ART1 art = new ART1();
     goto Label_01A7;
     Label_0014:
     if (0 != 0)
     {
         goto Label_005C;
     }
     Label_0020:
     if ((section = helper.ReadNextSection()) != null)
     {
         if (section.SectionName.Equals("ART1") && (section.SubSectionName.Equals("PARAMS") || (0 != 0)))
         {
             EngineArray.PutAll<string, string>(section.ParseParams(), art.Properties);
         }
         goto Label_0048;
     }
     return art;
     Label_0041:
     if ((-2 != 0) && (15 != 0))
     {
         if (0xff == 0)
         {
             goto Label_0014;
         }
         goto Label_0020;
     }
     Label_0048:
     if (!section.SectionName.Equals("ART1"))
     {
         goto Label_0014;
     }
     Label_005C:
     if (section.SubSectionName.Equals("NETWORK"))
     {
         IDictionary<string, string> dictionary2;
     Label_0166:
         dictionary2 = section.ParseParams();
         if (0 == 0)
         {
             art.A1 = EncogFileSection.ParseDouble(dictionary2, "A1");
             art.B1 = EncogFileSection.ParseDouble(dictionary2, "B1");
             art.C1 = EncogFileSection.ParseDouble(dictionary2, "C1");
             if (0 == 0)
             {
                 art.D1 = EncogFileSection.ParseDouble(dictionary2, "D1");
                 art.F1Count = EncogFileSection.ParseInt(dictionary2, "f1Count");
                 if (4 != 0)
                 {
                     if (0 != 0)
                     {
                         goto Label_0041;
                     }
                     if (0 != 0)
                     {
                         goto Label_0166;
                     }
                     art.F2Count = EncogFileSection.ParseInt(dictionary2, "f2Count");
                     art.NoWinner = EncogFileSection.ParseInt(dictionary2, "noWinner");
                 }
                 art.L = EncogFileSection.ParseDouble(dictionary2, "L");
                 art.Vigilance = EncogFileSection.ParseDouble(dictionary2, "VIGILANCE");
             }
             art.WeightsF1ToF2 = EncogFileSection.ParseMatrix(dictionary2, "weightsF1F2");
             art.WeightsF2ToF1 = EncogFileSection.ParseMatrix(dictionary2, "weightsF2F1");
             goto Label_0041;
         }
     }
     else
     {
         goto Label_0020;
     }
     Label_01A7:
     helper = new EncogReadHelper(mask0);
     goto Label_0020;
 }
Пример #6
0
 /// <summary>
 /// Generate the neural network.
 /// </summary>
 ///
 /// <returns>The generated neural network.</returns>
 public IMLMethod Generate()
 {
     var art = new ART1(_inputNeurons, _outputNeurons)
                   {
                       A1 = _a1,
                       B1 = _b1,
                       C1 = _c1,
                       D1 = _d1,
                       L = _l,
                       Vigilance = _vigilance
                   };
     return art;
 }
Пример #7
0
 public IMLMethod Generate()
 {
     ART1 art2 = new ART1(this._xcfe830a7176c14e5, this._x8f581d694fca0474);
     do
     {
         art2.A1 = this._x34f4b4706ab9e6e0;
         art2.B1 = this._x01ec8535a377ff25;
     }
     while (4 == 0);
     art2.C1 = this._x17a676523ef9e177;
     art2.D1 = this._xb071c5fc56907f5d;
     art2.L = this._x9fc3ee03a439f6f0;
     art2.Vigilance = this._x109822751b15259c;
     return art2;
 }