Repository navigation
arma: decide negative_values from the training data only - #182
Closed
gitRasheed wants to merge 1 commit into
Closed
gitRasheed wants to merge 1 commit into
gitRasheed wants to merge 1 commit into
Conversation
…n-support)
Mirrors R NNS.ARMA and NNS.ARMA.optim (OVVO-Financial/NNS
arma-train-support). nns_arma switched negative_values on when any value of
the variable was negative, including values after training_set that the
forecast never sees, so a held-out negative removed the clamp at 0 from the
forecast. It now looks at variable[:training_set] only.
nns_arma_optim scores validation forecasts from the training window, so it
also decides from variable[:training_set]. The out-of-sample forecast (h
set) is fitted on the whole series, so it and its bands stay unclamped when
any value is negative.
Before -> after (= R main):
nns_arma([20..1, -1], h=3, training_set=20, seasonal_factor=1, method="lin")
[0, -1, -2] -> [0, 0, 0]
nns_arma_optim on 58, 56, ..., 2, 1, .5, .2, .1, -.1 (training_set=29)
validation forecasts were negative (errors -0.78, -2.14, ..., -7.15);
now clamped (errors -0.78, -0.5, -0.2, -0.1, 0.1, bias.shift 0.33)
No cache entry moves.
Contributor
|
Incorporated through NNS R 14.0 integration #192, merged as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
R's
NNS.ARMAswitchednegative.valueson when any value of the variable was negative, including values aftertraining.setthat the forecast never sees. A held-out negative therefore removed the clamp at 0 from the forecast. OVVO-Financial/NNS#135 (merged) decides fromvariable[1:training.set].NNS.ARMA.optimdoes the same for its validation forecasts and decides the out-of-sample forecast from the whole series, which it is fitted on. This slice mirrors it.Stacked on #181; merge with a merge commit.
Changes
nns_armachecks for negatives after cutting the variable totraining_set.nns_arma_optimchecksvalues[:training_set]for the validation forecasts and their clamp. Withhset, the out-of-sample forecast and its bands useresults_negative_values, which is also on when any value of the whole series is negative.nns_arma([20..1, -1], h=3, training_set=20, seasonal_factor=1, method="lin")[0, -1, -2] -> [0, 0, 0]. For R's optim test series (58, 56, ..., 2, 1, .5, .2, .1, -.1, training_set=29), the validation forecasts used to run negative (errors -0.78 down to -7.15); they are now clamped, and errors (-0.778, -0.5, -0.2, -0.1, 0.1) and bias.shift 0.3296 equal R main's to 1e-12.Tests
h=3goes negative, plus R main's validation errors and bias shift.h=3forecast values. R main'sNNS.ARMA(method="nonlin")gives a different forecast for this series than the cache's R build, before and apart from Regenerate R parity cache for NNS 13.2 #135 (equal weights: -1.990 on R main, -2.145 on the base and in Python). That comes from the NNS.reg and dependence changes in Fix #95-#101: NNS.dep, NNS.caus and NNS.seas redesigns, with the follow-up fixes NNS#107, which Python takes with the core re-vendor.NNS_DISABLE_NATIVE=1: 2913 passed, 29 skipped, 2 xpassed. The 3 xfails are mode: break tied discrete modes by gravity, not their mean (mirrors R #111) #178's strict ones and the 2 xpasses the existing non-strict live-R VAR xfails. tests/parity/test_practical_examples.py against the usual R library: 9 passed, 2 xfailed, as on mode: break tied discrete modes by gravity, not their mean (mirrors R #111) #178. ruff check is clean on every changed file.Review
GPT-6.1 Sol reviewed the #135, #127 and #126 mirrors together: SHIP.
Mirrors OVVO-Financial/NNS#135