public class SimulatedAnealingMinimizer extends java.lang.Object
A cost minimizer which will fit a MovAvgModel to the data. This optimizer uses naive simulated annealing. Random solutions in the problem space are generated, compared against the last period of data, and the least absolute deviation is recorded as a cost. If the new cost is better than the old cost, the new coefficients are chosen. If the new solution is worse, there is a temperature-dependent probability it will be randomly selected anyway. This allows the algo to sample the problem space widely. As iterations progress, the temperature decreases and the algorithm rejects poor solutions more regularly, theoretically honing in on a global minimum.
Constructors Constructor Description
Modifier and Type Method Description
MovAvgModel model, EvictingQueue<java.lang.Double> train, double test)(Runs the simulated annealing algorithm and produces a model with new coefficients that, theoretically fit the data better and generalizes to future forecasts without overfitting.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
minimizepublic static MovAvgModel minimize(MovAvgModel model, EvictingQueue<java.lang.Double> train, double test)Runs the simulated annealing algorithm and produces a model with new coefficients that, theoretically fit the data better and generalizes to future forecasts without overfitting.
model- The MovAvgModel to be optimized for
train- A training set provided to the model, which predictions will be generated from
test- A test set of data to compare the predictions against and derive a cost for the model
- A new, minimized model that (theoretically) better fits the data