상속: Encog.ML.BasicML
예제 #1
0
 private BAMNetwork Create()
 {
     var network = new BAMNetwork(6, 3);
     network.WeightsF1ToF2[1, 1] = 2.0;
     network.WeightsF2ToF1[2, 2] = 3.0;
     return network;
 }
예제 #2
0
파일: PersistBAM.cs 프로젝트: neismit/emds
 public object Read(Stream mask0)
 {
     EncogFileSection section;
     BAMNetwork network = new BAMNetwork();
     EncogReadHelper helper = new EncogReadHelper(mask0);
     goto Label_002F;
     Label_000B:
     if (!section.SectionName.Equals("BAM"))
     {
         goto Label_002F;
     }
     Label_001D:
     if (section.SubSectionName.Equals("NETWORK"))
     {
         IDictionary<string, string> paras = section.ParseParams();
         network.F1Count = EncogFileSection.ParseInt(paras, "f1Count");
         network.F2Count = EncogFileSection.ParseInt(paras, "f2Count");
         if (0 != 0)
         {
             goto Label_000B;
         }
         network.WeightsF1ToF2 = EncogFileSection.ParseMatrix(paras, "weightsF1F2");
         if (0 != 0)
         {
             goto Label_00C2;
         }
         network.WeightsF2ToF1 = EncogFileSection.ParseMatrix(paras, "weightsF2F1");
     }
     Label_002F:
     if ((section = helper.ReadNextSection()) != null)
     {
         if (!section.SectionName.Equals("BAM"))
         {
             goto Label_000B;
         }
     }
     else
     {
         return network;
     }
     Label_00AB:
     if (section.SubSectionName.Equals("PARAMS"))
     {
         EngineArray.PutAll<string, string>(section.ParseParams(), network.Properties);
     }
     else
     {
         goto Label_000B;
     }
     Label_00C2:
     if (0 != 0)
     {
         goto Label_00AB;
     }
     if (15 != 0)
     {
         goto Label_000B;
     }
     goto Label_001D;
 }
예제 #3
0
        /// <inheritdoc/>
        public Object Read(Stream mask0)
        {
            var result = new BAMNetwork();
            var ins0   = new EncogReadHelper(mask0);
            EncogFileSection section;

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

                    result.F1Count = EncogFileSection.ParseInt(p,
                                                               PersistConst.PropertyF1Count);
                    result.F2Count = EncogFileSection.ParseInt(p,
                                                               PersistConst.PropertyF2Count);
                    result.WeightsF1ToF2 = EncogFileSection.ParseMatrix(p, PersistConst.PropertyWeightsF1F2);
                    result.WeightsF2ToF1 = EncogFileSection.ParseMatrix(p, PersistConst.PropertyWeightsF2F1);
                }
            }

            return(result);
        }
예제 #4
0
파일: PersistBAM.cs 프로젝트: neismit/emds
        /// <inheritdoc/>
        public Object Read(Stream mask0)
        {
            var result = new BAMNetwork();
            var ins0 = new EncogReadHelper(mask0);
            EncogFileSection section;

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

                    result.F1Count = EncogFileSection.ParseInt(p,
                                                               PersistConst.PropertyF1Count);
                    result.F2Count = EncogFileSection.ParseInt(p,
                                                               PersistConst.PropertyF2Count);
                    result.WeightsF1ToF2 = EncogFileSection.ParseMatrix(p,PersistConst.PropertyWeightsF1F2);
                    result.WeightsF2ToF1 = EncogFileSection.ParseMatrix(p,PersistConst.PropertyWeightsF2F1);
                }
            }

            return result;
        }
예제 #5
0
 private void ValidateBAM(BAMNetwork 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]);
 }
예제 #6
0
 /// <returns>The generated network.</returns>
 public IMLMethod Generate()
 {
     var bam = new BAMNetwork(_f1Neurons, _f2Neurons);
     return bam;
 }
 public void RunBAM(BAMNetwork network, NeuralDataMapping data)
 {
     var line = new StringBuilder();
     line.Append(MappingToString(data));
     network.Compute(data);
     line.Append("  |  ");
     line.Append(MappingToString(data));
     app.WriteLine(line.ToString());
 }