jsat.math.decayrates
Class LinearDecay
- java.lang.Object
-
- jsat.math.decayrates.LinearDecay
-
- All Implemented Interfaces:
- java.io.Serializable, DecayRate, Parameterized
public class LinearDecay extends java.lang.Object implements DecayRate, Parameterized
The Linear Decay requires the maximum time step to be explicitly known ahead of time. Provided either in the call torate(double, double, double), or internal bysetMinRate(double).
The Linear Decay will decay at a constant rate / slope from the initial value until the specifiedsetMinRate(double)is reached.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description LinearDecay()Creates a new linear decay that goes down to 1e-4 after 100,000 units of timeLinearDecay(double min, double maxTime)Creates a new Linear Decay
Note that when usingrate(double, double, double), the maxTime is always superceded by the value given to the function.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description DecayRateclone()doublegetMaxTime()Returns the maximum time to use in the rate decaydoublegetMinRate()Returns the minimum value to return from he rate methodsdoublerate(double time, double initial)Decays the initial value over time.doublerate(double time, double maxTime, double initial)Decays the initial value over time.voidsetMaxTime(double maxTime)Sets the maximum amount of time to allow in the rate decay.voidsetMinRate(double min)Sets the minimum learning rate to returnjava.lang.StringtoString()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
LinearDecay
public LinearDecay()
Creates a new linear decay that goes down to 1e-4 after 100,000 units of time
-
LinearDecay
public LinearDecay(double min, double maxTime)Creates a new Linear Decay
Note that when usingrate(double, double, double), the maxTime is always superceded by the value given to the function.- Parameters:
min- a value less than the learning rate that, that will be the minimum returned valuemaxTime- the maximum amount of time
-
-
Method Detail
-
setMinRate
public void setMinRate(double min)
Sets the minimum learning rate to return- Parameters:
min- the minimum learning rate to return
-
getMinRate
public double getMinRate()
Returns the minimum value to return from he rate methods- Returns:
- the minimum value to return
-
setMaxTime
public void setMaxTime(double maxTime)
Sets the maximum amount of time to allow in the rate decay. Any time value larger will be treated as the set maximum.
Any calls torate(double, double, double)will use the value provided in that method call instead.- Parameters:
maxTime- the maximum amount of time to allow
-
getMaxTime
public double getMaxTime()
Returns the maximum time to use in the rate decay- Returns:
- the maximum time to use in the rate decay
-
rate
public double rate(double time, double maxTime, double initial)Description copied from interface:DecayRateDecays the initial value over time.
-
rate
public double rate(double time, double initial)Description copied from interface:DecayRateDecays the initial value over time.
-
clone
public DecayRate clone()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG