/// <summary>
        /// Resume training.
        /// </summary>
        ///
        /// <param name="state">The training state to return to.</param>
        public override sealed void Resume(TrainingContinuation state)
        {
            if (!IsValidResume(state))
            {
                throw new TrainingError("Invalid training resume data length");
            }
            var lastGradient = (double[])state.Get(LastGradientsConst);
            var updateValues = (double[])state.Get(UpdateValuesConst);

            EngineArray.ArrayCopy(lastGradient, LastGradient);
            EngineArray.ArrayCopy(updateValues, _updateValues);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Resume training.
        /// </summary>
        ///
        /// <param name="state">The training state to return to.</param>
        public override sealed void Resume(TrainingContinuation state)
        {
            if (!IsValidResume(state))
            {
                throw new TrainingError("Invalid training resume data length");
            }

            _lastDelta = (double[])state.Get(PropertyLastDelta);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Determine if the specified continuation object is valid to resume with.
        /// </summary>
        ///
        /// <param name="state">The continuation object to check.</param>
        /// <returns>True if the specified continuation object is valid for this
        /// training method and network.</returns>
        public bool IsValidResume(TrainingContinuation state)
        {
            if (!state.Contents.ContainsKey(PropertyLastDelta))
            {
                return(false);
            }

            if (!state.TrainingType.Equals(GetType().Name))
            {
                return(false);
            }

            var d = (double[])state.Get(PropertyLastDelta);

            return(d.Length == ((IContainsFlat)Method).Flat.Weights.Length);
        }
        /// <summary>
        /// Determine if the specified continuation object is valid to resume with.
        /// </summary>
        ///
        /// <param name="state">The continuation object to check.</param>
        /// <returns>True if the specified continuation object is valid for this
        /// training method and network.</returns>
        public bool IsValidResume(TrainingContinuation state)
        {
            if (!state.Contents.ContainsKey(
                    LastGradientsConst) ||
                !state.Contents.ContainsKey(
                    UpdateValuesConst))
            {
                return(false);
            }

            if (!state.TrainingType.Equals(GetType().Name))
            {
                return(false);
            }

            var d = (double[])state.Get(LastGradientsConst);

            return(d.Length == Network.Flat.Weights.Length);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Resume training.
        /// </summary>
        ///
        /// <param name="state">The training state to return to.</param>
        public override sealed void Resume(TrainingContinuation state)
        {
            if (!IsValidResume(state))
            {
                throw new TrainingError("Invalid training resume data length");
            }
            var lastGradient = (double[]) state.Get(LastGradientsConst);
            var updateValues = (double[]) state.Get(UpdateValuesConst);

            EngineArray.ArrayCopy(lastGradient,LastGradient);
            EngineArray.ArrayCopy(updateValues,_updateValues);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Determine if the specified continuation object is valid to resume with.
        /// </summary>
        ///
        /// <param name="state">The continuation object to check.</param>
        /// <returns>True if the specified continuation object is valid for this
        /// training method and network.</returns>
        public bool IsValidResume(TrainingContinuation state)
        {
            if (!state.Contents.ContainsKey(
                LastGradientsConst)
                || !state.Contents.ContainsKey(
                    UpdateValuesConst))
            {
                return false;
            }

            if (!state.TrainingType.Equals(GetType().Name))
            {
                return false;
            }

            var d = (double[]) state.Get(LastGradientsConst);
            return d.Length == Network.Flat.Weights.Length;
        }
        /// <summary>
        /// Resume training.
        /// </summary>
        ///
        /// <param name="state">The training state to return to.</param>
        public override sealed void Resume(TrainingContinuation state)
        {
            if (!IsValidResume(state))
            {
                throw new TrainingError("Invalid training resume data length");
            }

            _lastDelta = (double[])state.Get(PropertyLastDelta);
        }
        /// <summary>
        /// Determine if the specified continuation object is valid to resume with.
        /// </summary>
        ///
        /// <param name="state">The continuation object to check.</param>
        /// <returns>True if the specified continuation object is valid for this
        /// training method and network.</returns>
        public bool IsValidResume(TrainingContinuation state)
        {
            if (!state.Contents.ContainsKey(PropertyLastDelta))
            {
                return false;
            }

            if (!state.TrainingType.Equals(GetType().Name))
            {
                return false;
            }

            var d = (double[])state.Get(PropertyLastDelta);
            return d.Length == ((IContainsFlat) Method).Flat.Weights.Length;
        }