Skip to content

Fix parameter forwarding in fit_predict and correct progress loss normalisation#14

Open
harens wants to merge 1 commit into
Thijsvanede:mainfrom
harens:fix/interpreter-api-and-logging
Open

Fix parameter forwarding in fit_predict and correct progress loss normalisation#14
harens wants to merge 1 commit into
Thijsvanede:mainfrom
harens:fix/interpreter-api-and-logging

Conversation

@harens

@harens harens commented Apr 23, 2026

Copy link
Copy Markdown

This PR fixes two issues in inference configuration and training progress reporting.

1. Forward fit_predict parameters correctly

Interpreter.fit_predict() previously ignored caller-provided iterations, batch_size, and verbose, always using hardcoded defaults when calling predict().

This PR forwards those arguments through so runtime behaviour matches the caller’s configuration.


2. Fix progress loss normalisation

Progress loss was previously accumulated as:

total_loss += loss.item() / X_.shape[1]
total_items += X_.shape[0]

This mixes units: the loss is scaled per timestep (X_.shape[1]), but averaged per sequence (X_.shape[0]), which underestimates the true mean loss.

The update instead:

total_loss  += loss.item()
total_items += X_.shape[0] * y_.shape[1]

i.e.

  • accumulate the total loss over all predictions
  • divide by the total number of target elements (batch_size × sequence_length)

This makes the reported loss a true per-prediction average.

This change affects only the progress display, not optimisation or model outputs.

Forward caller-provided iterations, batch_size, and verbose values from Interpreter.fit_predict() into the final predict() call.

Normalise ContextBuilder progress loss over target predictions while leaving the accumulated training loss and optimisation behaviour unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant