`model_selection.split_data_train_validation_test`: Test set starts one point too early

Aperta
#774 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@egordm ci sta già lavorando.

Dal 16/12/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

fix

When calling model_selection.split_data_train_validation_test() in backtest mode, the test set starts one point too early. Assume you have a DataFrame of size 100, and test_fraction is 0.1.
Then start_date_test = end_date - np.round(number_indices * test_fraction) * delta (line 176) implies that the test set starts 10 time steps earlier than the last timestamp. So, because we have 100 timestamps in this simple example, the test set starts from timestamp 90. Due to this off-by-one-error, the actual test set size is 11, instead of the expected 10.

A simple fix would be to change line 176 in model_selection/model_selection.py to

start_date_test = end_date - (np.round(number_indices * test_fraction) - 1) * delta
Lingua principale
Python
Stelle
169
Fork
59
Merge medio
4g 15h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenSTEF/openstef

Tutte le issue di OpenSTEF/openstef

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.