/// <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); }
/// <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); }
/// <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"); } var lastGradient = (double[]) state.Get(LastGradientsConst); var updateValues = (double[]) state.Get(UpdateValuesConst); EngineArray.ArrayCopy(lastGradient,LastGradient); EngineArray.ArrayCopy(updateValues,_updateValues); }
/// <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> /// 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; }