PROWAREtech

articles » current » dot-net » inverted-sigmoid-decay

.NET: Inverted Sigmoid Decay Function

A function that returns a value nearer to an initial value in the beginning then, as the input is nears the end, it begins to decrease its output; graphed it would be nearly straight until it would steeply decrease near the end.

// Inverted Sigmoid Decay function
// This will decrease the output as each iteration completes but more so as the current iteration reaches the max number of iterations.
// gamma: Controls the sharpness of the drop-off. A higher gamma, like 100, will create a steeper decline near the end.
// delta: Shifts the decay curve closer to the end. Increasing delta (e.g., 0.9) pushes most of the drop toward the end.
// begin: This is the initial number to start with.
// end: This is the number to have at the end when maxIterations is hit.
double InvertedSigmoidDecay(double begin, double end, double currentIteration, double maxIterations, double gamma = 10, double delta = 0.9)
{
	double scale = 1.0 / (1.0 + Math.Exp(-gamma * (currentIteration / maxIterations - delta)));
	return end + (begin - end) * (1.0 - scale);
}

Graphed with a begin y value of 10, an end y value of 4 and a maxIterations value of 100 (default gamma and delta).

Inverted Sigmoid Decay

PROWAREtech

Hello there! How can I help you today?
Ask any question

PROWAREtech

This site uses cookies. Cookies are simple text files stored on the user's computer. They are used for adding features and security to this site. Read the privacy policy.
CLOSE