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

Upgrading from 0.4.4 to 0.5.0 #9

Closed
sam0x17 opened this issue Feb 4, 2023 · 2 comments
Closed

Upgrading from 0.4.4 to 0.5.0 #9

sam0x17 opened this issue Feb 4, 2023 · 2 comments

Comments

@sam0x17
Copy link

sam0x17 commented Feb 4, 2023

Are there any release notes on the changes made from verzion 0.4.4 to 0.5.0? I am upgrading an old codebase that I inherited from another developer and I am encountering some errors that suggest that some of the underlying behavior of linregress has changed in some way as of version 0.5.0. In particular, there was a line that looks like this after upgrading:

Some((model.parameters()[0], model.parameters()[1..].to_vec(), model.se().to_vec()))

This compiles, however now we get a number of unit test failures as a result of this. Would appreciate any insight into what the 0.5.0 changes included and what I can eo to upgrade the code properly.

@n1m3
Copy link
Owner

n1m3 commented Feb 4, 2023

I'm assuming it's this code from the substrate crate.

This appears to be a regression I introduced here.
The code in substrate forces the intercept value to 0, which results in a standard error of exactly 0, which then leads to a division by zero when calculating the t-value for the intercept.

Previously the resulting Nan was simply propagated into the p-value, but now gets rejected by the new students_t_cdf and fitting the model fails with an error.

fit_low_level_regression_model expects that 1 is passed as the intercept value and not 0, so arguably the way it is used in substrate is wrong.

However it's definitely a bug that the model suddenly fails to fit when it previously would.
I have fixed this bug by preventing the division by zero, which results in a p-value of 1.0 for the intercept in this specific case.

This fix is included in the new version 0.5.1 and upgrading to that instead of 0.5 should fix the test failures.

Please let me know if this does indeed fix the problem or if there is something I have missed.

@sam0x17
Copy link
Author

sam0x17 commented Feb 5, 2023

thanks so much, that worked!

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

No branches or pull requests

2 participants