Click or drag to resize
Accord.NET (logo)

RelativeParameterConvergence Class

Relative parameter change convergence criteria.
Inheritance Hierarchy
SystemObject
  Accord.MathRelativeParameterConvergence

Namespace:  Accord.Math
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
public class RelativeParameterConvergence : IConvergence<double[]>, 
	IConvergence
Request Example View Source

The RelativeParameterConvergence type exposes the following members.

Constructors
  NameDescription
Public methodRelativeParameterConvergence
Initializes a new instance of the RelativeParameterConvergence class.
Public methodRelativeParameterConvergence(Int32, Double)
Initializes a new instance of the RelativeParameterConvergence class.
Top
Properties
  NameDescription
Public propertyCurrentIteration
Gets or sets the current iteration number.
Public propertyDelta
Gets the maximum relative parameter change after the last iteration.
Public propertyHasConverged
Gets whether the algorithm has converged.
Public propertyHasDiverged
Gets whether the algorithm has diverged.
Public propertyIterations Obsolete.
Please use MaxIterations instead.
Public propertyMaxIterations
Gets or sets the maximum number of iterations performed by the iterative algorithm.
Public propertyNewValues
Gets or sets the watched value after the iteration.
Public propertyOldValues
Gets or sets the watched value before the iteration.
Public propertyTolerance
Gets or sets the maximum change in the watched value after an iteration of the algorithm used to detect convergence.
Top
Methods
  NameDescription
Public methodClear
Clears this instance.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks
This class can be used to track progress and convergence of methods which rely on the maximum relative change of the values within a parameter vector.
Examples
// Converge if the maximum change amongst all parameters is less than 0.1:
var criteria = new RelativeParameterConvergence(iterations: 0, tolerance: 0.1);

int progress = 1;
double[] parameters = { 12345.6, 952.12, 1925.1 };

do
{
    // Do some processing...

    // Update current iteration information:
    criteria.NewValues = parameters.Divide(progress++);

} while (!criteria.HasConverged);


// The method will converge after reaching the 
// maximum of 11 iterations with a final value
// of { 1234.56, 95.212, 192.51 }:

int iterations = criteria.CurrentIteration; // 11
var v = criteria.OldValues; // { 1234.56, 95.212, 192.51 }
See Also