diffrax icon indicating copy to clipboard operation
diffrax copied to clipboard

Treating Channels that only have missing values in interpolations

Open JadM133 opened this issue 1 year ago • 1 comments

While using "diffrax.backward_hermite_coefficients", I noticed that the interpolation technique doesn't take into consideration the case when all the entries are missing (i.e. NaN), even if "replace_nans_at_start" is specified. I beleive that the logical thing to have is just a constant value in these channels (equal to the one specified by replace_nans_at_start), but the interpolation technique is returning NaNs as coefficients.

As a reproducable example, I used a function that has been used in the neural_cde example (get_data), and I updated the last couple of lines to stack channels with only NaN values.

issue

The result of the print statement when I run get_data(1000, False, key=jrandom.PRNGKey(0)) is as follows:

result

Thank you in advance!

JadM133 avatar Oct 11 '23 14:10 JadM133

Thanks for the report!

I beleive that the logical thing to have is just a constant value in these channels (equal to the one specified by replace_nans_at_start)

I agree, this would be better behaviour.

I'm not sure I'll have time to tackle this one soon -- if anyone feels up to it I'd be happy to take a PR fixing this.

patrick-kidger avatar Oct 11 '23 19:10 patrick-kidger