Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnequalArrays = errors.New("coordinate arrays are of different lengths") ErrInsufficientData = errors.New("not enough data to make a prediction") )
View Source
var ( // LeastSquaresPredictor uses the ordinary least squares method of // estimation to predict future values LeastSquaresPredictor = &olsPredictor{} )
Functions ¶
func LeastSquares ¶
LeastSquares calculates the slope and y-intercept of the line of best fit for the series of points represented as arrays of x- and y-coordinates using the Ordinary Least Squares method.
Types ¶
type Predictor ¶
type Predictor interface { // Predict uses the timestamp/value pairs passed in to predict the value at // time now+period Predict(period time.Duration, timestamps, values []float64) (float64, error) }
Predictor represents a strategy for predicting a future value based on historic values
Click to show internal directories.
Click to hide internal directories.