object

knn_forecasting

k-Nearest Neighbors (analog method) time series forecaster: matches the most recent window of observations against historical windows of the same length and predicts by aggregating what followed the most similar ones. Supports multiple distance metrics, neighbor weighting schemes, optional differencing, and missing observations represented as unbound variables.

Availability:
logtalk_load(knn_forecasting(loader))
Author: Paulo Moura
Version: 1:0:0
Date: 2026-10-14
Compilation flags:
static, context_switching_calls
Imports:
Uses:
Remarks:
(none)

Public predicates

update/3

Returns a new forecaster after appending one observation. Observation may be left an unbound variable to represent a missing observation; see update/4.

Compilation flags:
static
Template:
update(Forecaster,Observation,UpdatedForecaster)
Mode and number of proofs:
update(+compound,@number,-compound) - one_or_error
Exceptions:
Forecaster is a variable:
instantiation_error
Forecaster is neither a variable nor a valid forecaster:
domain_error(forecaster,Forecaster)
Observation is neither a variable nor a number:
type_error(number,Observation)

Protected predicates

(no local declarations; see entity ancestors if any)

Private predicates

(no local declarations; see entity ancestors if any)

Operators

(none)