Locally weighted is a non-parametric algorithm, that is, the model does not learn a fixed set of parameters as is done in ordinary . Rather parameters Θ (theta) are computed individually for each query point x. While computing Θ, a higher “preference” is given to the points in the training set lying in the vicinity of x than the points lying far away from x.
For a detailed discussion see https://www.geeksforgeeks.org/ml-locally...
and for the formula see https://fawda123.github.io/swmp_workshop...
Here you can see a shortcut application of this technique to time series with results unexpectedly favorable for price data labelling.
Good at detecting pullbacks. Can be incorporated into a trading system as a signal generator. Alerting is included.
or add these lines:
scaleMinimax(X, p, min, max) =>
hi = highest(X, p), lo = lowest(X, p)
(max - min) * (X - lo)/(hi - lo) + min
scale(X, p) => scaleMinimax(X, p, lowest(close, p), highest(close, p))
locally_weighted(x, p, b, mx) =>
PI = 3.14159265359
l = 0.0
for i=0 to p-1
l := b + b*i + b*2*x + b*sin(2*PI*i) + b*cos(2*PI*i)
scale(linreg(l, p, 0), mx)
price = input(close, "Price Data")
p = input(5, "Lookback Window")
span = input(8, "Rising/Falling span", minval=2)
crvs = input(false, "Show curves?")
lbls = input(true, "Show Labels?")
mmx = input(2, "Scaler Lookback", minval=1)
BETA = .5
lwr = locally_weighted(price, p, BETA, mmx)