Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nan interpolation for descending direction #1

Closed
Puumanamana opened this issue Sep 27, 2021 · 2 comments
Closed

Nan interpolation for descending direction #1

Puumanamana opened this issue Sep 27, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Puumanamana
Copy link

Hi,

Thanks for developing this crate, it's very convenient for my application!
I was able to make it work pretty easily. However, I'm having issues with the interpolate function in the case of a descending direction. Here's an example:

let regression = IsotonicRegression::new_descending(
        &[
            Point::new(0.0, 3.0),
            Point::new(1.0, 2.0),
            Point::new(2.0, 1.0)
        ]
);
println!("{:}", regression.interpolate(0.5));
// Returns NaN

This issue however doesn't occur on an ascending direction when I reverse the order of the y coordinates. Any idea what's happening?

Thank you!

@sanity sanity self-assigned this Sep 27, 2021
@sanity sanity closed this as completed in 3018182 Sep 27, 2021
@sanity
Copy link
Owner

sanity commented Sep 27, 2021

Thanks for the bug report. This was due to an error in the logic for descending. I've replaced this with a more straightforward implementation and added a test for this problem, released as 0.2.4. Please let me know if you have further issues.

@sanity sanity added the bug Something isn't working label Sep 27, 2021
@Puumanamana
Copy link
Author

It worked, thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants