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

Small differences in prediction between operating systems #57

Open
schuemie opened this issue Mar 31, 2022 · 3 comments
Open

Small differences in prediction between operating systems #57

schuemie opened this issue Mar 31, 2022 · 3 comments

Comments

@schuemie
Copy link
Member

Just trying to understand: we're fitting a not-so-large logistic regression (for a propensity score) using the exact same data on two platforms (Windows and Linux). The fitted model coefficients are identical, but there are tiny differences in the predicted propensity scores. The maximum difference between PS is 9.99e-16. (Ironically, this leads to different PS matching, leading to larger differences in the effect size estimate). There's no sampling before fitting the model, so we're calling Cyclops' predict() on the same data used to fit the model.

Repeat runs on the same OS produce the exact same result, so results are reproducible in that sense. We compared the output of .Machine in R , and the only difference we see is sizeof.long = 4 on Windows and sizeof.long = 8 on Linux.

Any thoughts what could explain these differences?

@msuchard
Copy link
Member

Now, this is very interesting!

Is the model fit with cross-validation (in which case the PRNG may differ between machines) and the observed coefficients may look the same but are actually a little different?

Otherwise, I'll need to explore the code-base a bit for a better idea. In terms of a solution, we could round the predicted scores, say, to the nearest 1E-10 before matching.

@schuemie
Copy link
Member Author

schuemie commented Apr 1, 2022

Yes, we're using cross-validation, and in fact there's a difference of 3.469447e-16 in the optimal hyperparameter! But as far as R is concerned, the fitted coefficients are identical (using the '==' operator). Does Cyclops use a higher precision internally?

Since we're actually running on simulated data (Synpuf), I can share the actual patient-level data with you. I'll send an e-mail.

@schuemie
Copy link
Member Author

schuemie commented Apr 1, 2022

(BTW, rounding the PS scores sounds like an excellent idea)

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