コード例 #1
1
        /// <inheritdoc/>
        public Object Read(Stream mask0)
        {
            var result = new TrainingContinuation();
            var ins0 = new EncogReadHelper(mask0);
            EncogFileSection section;

            while ((section = ins0.ReadNextSection()) != null)
            {
                if (section.SectionName.Equals("CONT")
                    && section.SubSectionName.Equals("PARAMS"))
                {
                    IDictionary<String, String> paras = section.ParseParams();

                    foreach (String key  in  paras.Keys)
                    {
                        if (key.Equals("type", StringComparison.InvariantCultureIgnoreCase))
                        {
                            result.TrainingType = paras[key];
                        }
                        else
                        {
                            double[] list = EncogFileSection
                                .ParseDoubleArray(paras, key);
                            result.Put(key, list);
                        }
                    }
                }
            }

            return result;
        }
コード例 #2
0
        /// <inheritdoc/>
        public Object Read(Stream mask0)
        {
            var result = new TrainingContinuation();
            var ins0   = new EncogReadHelper(mask0);
            EncogFileSection section;

            while ((section = ins0.ReadNextSection()) != null)
            {
                if (section.SectionName.Equals("CONT") &&
                    section.SubSectionName.Equals("PARAMS"))
                {
                    IDictionary <String, String> paras = section.ParseParams();

                    foreach (String key  in  paras.Keys)
                    {
                        if (key.Equals("type", StringComparison.InvariantCultureIgnoreCase))
                        {
                            result.TrainingType = paras[key];
                        }
                        else
                        {
                            double[] list = section.ParseDoubleArray(paras, key);
                            result.Put(key, list);
                        }
                    }
                }
            }

            return(result);
        }
コード例 #3
0
ファイル: ResilientPropagation.cs プロジェクト: neismit/emds
 public override sealed TrainingContinuation Pause()
 {
     TrainingContinuation continuation = new TrainingContinuation {
         TrainingType = base.GetType().Name
     };
     continuation.Set("LAST_GRADIENTS", ((TrainFlatNetworkResilient) base.FlatTraining).LastGradient);
     continuation.Set("UPDATE_VALUES", ((TrainFlatNetworkResilient) base.FlatTraining).UpdateValues);
     return continuation;
 }
コード例 #4
0
ファイル: Backpropagation.cs プロジェクト: neismit/emds
 public bool IsValidResume(TrainingContinuation state)
 {
     if (!state.Contents.ContainsKey("LAST_DELTA"))
     {
         return false;
     }
     if (!state.TrainingType.Equals(base.GetType().Name))
     {
         return false;
     }
     double[] numArray = (double[]) state.Get("LAST_DELTA");
     return (numArray.Length == ((IContainsFlat) this.Method).Flat.Weights.Length);
 }
コード例 #5
0
ファイル: ResilientPropagation.cs プロジェクト: neismit/emds
 public override sealed void Resume(TrainingContinuation state)
 {
     if (!this.IsValidResume(state))
     {
         throw new TrainingError("Invalid training resume data length");
     }
     double[] src = (double[]) state.Get("LAST_GRADIENTS");
     double[] numArray2 = (double[]) state.Get("UPDATE_VALUES");
     EngineArray.ArrayCopy(src, ((TrainFlatNetworkResilient) base.FlatTraining).LastGradient);
     if (8 != 0)
     {
     }
     EngineArray.ArrayCopy(numArray2, ((TrainFlatNetworkResilient) base.FlatTraining).UpdateValues);
 }
コード例 #6
0
ファイル: ResilientPropagation.cs プロジェクト: neismit/emds
 public bool IsValidResume(TrainingContinuation state)
 {
     if (state.Contents.ContainsKey("LAST_GRADIENTS"))
     {
         if (0 == 0)
         {
             if (0x7fffffff != 0)
             {
             }
             if (!state.Contents.ContainsKey("UPDATE_VALUES"))
             {
                 goto Label_004B;
             }
         }
         if (state.TrainingType.Equals(base.GetType().Name))
         {
             double[] numArray = (double[]) state.Get("LAST_GRADIENTS");
             return (numArray.Length == ((IContainsFlat) this.Method).Flat.Weights.Length);
         }
         return false;
     }
     Label_004B:
     return false;
 }
コード例 #7
0
 /// <summary>
 /// from Encog.ml.train.MLTrain
 /// </summary>
 ///
 public abstract void Resume(
     TrainingContinuation state);
コード例 #8
0
ファイル: NEATTraining.cs プロジェクト: neismit/emds
 /// <inheritdoc/>
 public void Resume(TrainingContinuation state)
 {
 }
コード例 #9
0
ファイル: QuickPropagation.cs プロジェクト: neismit/emds
 public override void Resume(TrainingContinuation state)
 {
     if (!this.IsValidResume(state))
     {
         throw new TrainingError("Invalid training resume data length");
     }
     double[] src = (double[]) state.Contents["LAST_GRADIENTS"];
     EngineArray.ArrayCopy(src, ((TrainFlatNetworkQPROP) base.FlatTraining).LastGradient);
 }
コード例 #10
0
ファイル: QuickPropagation.cs プロジェクト: neismit/emds
 public override TrainingContinuation Pause()
 {
     TrainingContinuation continuation;
     TrainingContinuation continuation2 = new TrainingContinuation();
     do
     {
         continuation2.TrainingType = base.GetType().Name;
         continuation = continuation2;
         TrainFlatNetworkQPROP flatTraining = (TrainFlatNetworkQPROP) base.FlatTraining;
         double[] lastGradient = flatTraining.LastGradient;
         continuation.Contents["LAST_GRADIENTS"] = lastGradient;
     }
     while (0x7fffffff == 0);
     return continuation;
 }
コード例 #11
0
        /// <summary>
        /// Load the object.
        /// </summary>
        /// <param name="xmlin">The XML object to load from.</param>
        /// <returns>The loaded object.</returns>
        public IEncogPersistedObject Load(ReadXML xmlin)
        {
            this.current = new TrainingContinuation();

            String name = xmlin.LastTag.Attributes[
                    EncogPersistedCollection.ATTRIBUTE_NAME];
            String description = xmlin.LastTag.Attributes[
                    EncogPersistedCollection.ATTRIBUTE_DESCRIPTION];

            this.current.Name = name;
            this.current.Description = description;

            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(TrainingContinuationPersistor.TAG_ITEMS, true))
                {
                    HandleItems(xmlin);
                }
                else if (xmlin.IsIt(
                    EncogPersistedCollection.TYPE_TRAINING_CONTINUATION, false))
                {
                    break;
                }
            }

            return this.current;
        }
コード例 #12
0
 /// <summary>
 /// Determine if this specified training continuation object is valid for
 /// this training method.
 /// </summary>
 /// <param name="state">The training continuation object to check.</param>
 /// <returns>True if the continuation object is valid.</returns>
 public virtual bool IsValidResume(TrainingContinuation state)
 {
     return(false);
 }
コード例 #13
0
 public object Read(Stream mask0)
 {
     EncogReadHelper helper;
     EncogFileSection section;
     IDictionary<string, string> dictionary;
     TrainingContinuation continuation = new TrainingContinuation();
     if (3 != 0)
     {
         helper = new EncogReadHelper(mask0);
         goto Label_001E;
     }
     Label_0010:
     if ((-2 == 0) || (4 == 0))
     {
         goto Label_005C;
     }
     Label_001E:
     if ((section = helper.ReadNextSection()) == null)
     {
         return continuation;
     }
     if (!section.SectionName.Equals("CONT"))
     {
         if (1 != 0)
         {
             if (0xff == 0)
             {
                 return continuation;
             }
             goto Label_0010;
         }
         if (0 == 0)
         {
             goto Label_0077;
         }
         goto Label_001E;
     }
     Label_005C:
     if (section.SubSectionName.Equals("PARAMS"))
     {
         dictionary = section.ParseParams();
     }
     else if ((0 == 0) && ((0 != 0) || (3 != 0)))
     {
         goto Label_001E;
     }
     Label_0077:
     using (IEnumerator<string> enumerator = dictionary.Keys.GetEnumerator())
     {
         string current;
         double[] numArray;
         goto Label_0090;
     Label_0086:
         continuation.Put(current, numArray);
     Label_0090:
         if (enumerator.MoveNext())
         {
             current = enumerator.Current;
             if (current.Equals("type", StringComparison.InvariantCultureIgnoreCase))
             {
                 continuation.TrainingType = dictionary[current];
                 goto Label_0090;
             }
             numArray = EncogFileSection.ParseDoubleArray(dictionary, current);
             if (0xff != 0)
             {
             }
             goto Label_0086;
         }
     }
     goto Label_001E;
 }
コード例 #14
0
ファイル: Backpropagation.cs プロジェクト: neismit/emds
 public override sealed TrainingContinuation Pause()
 {
     TrainingContinuation continuation;
     TrainingContinuation continuation2 = new TrainingContinuation {
         TrainingType = base.GetType().Name
     };
     if (0 == 0)
     {
         continuation = continuation2;
         TrainFlatNetworkBackPropagation flatTraining = (TrainFlatNetworkBackPropagation) base.FlatTraining;
         double[] lastDelta = flatTraining.LastDelta;
         continuation.Set("LAST_DELTA", lastDelta);
     }
     return continuation;
 }
コード例 #15
0
 /// <inheritdoc/>
 public override void Resume(TrainingContinuation state)
 {
 }
コード例 #16
0
 /// <summary>
 /// Resume training.
 /// </summary>
 /// <param name="state">The training continuation object to use to continue.</param>
 public virtual void Resume(TrainingContinuation state)
 {
     throw new TrainingError("This training type does not support resume.");
 }
コード例 #17
0
 /// <inheritdoc/>
 public override void Resume(TrainingContinuation state)
 {
     // TODO Auto-generated method stub
 }
コード例 #18
0
        /// <summary>
        /// Save the object.
        /// </summary>
        /// <param name="obj">The object to save.</param>
        /// <param name="xmlout">The XML output object.</param>
        public void Save(IEncogPersistedObject obj, WriteXML xmlout)
        {

            PersistorUtil.BeginEncogObject(
                    EncogPersistedCollection.TYPE_TRAINING_CONTINUATION, xmlout, obj,
                    true);
            this.current = (TrainingContinuation)obj;

            xmlout.BeginTag(TrainingContinuationPersistor.TAG_ITEMS);
            SaveItems(xmlout);
            xmlout.EndTag();

            xmlout.EndTag();
        }
コード例 #19
0
ファイル: Backpropagation.cs プロジェクト: neismit/emds
 public override sealed void Resume(TrainingContinuation state)
 {
     if (!this.IsValidResume(state))
     {
         throw new TrainingError("Invalid training resume data length");
     }
     ((TrainFlatNetworkBackPropagation) base.FlatTraining).LastDelta = (double[]) state.Get("LAST_DELTA");
 }