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

adding code for existing scikit learn model #531

Merged
merged 13 commits into from
Jan 28, 2025
Merged

adding code for existing scikit learn model #531

merged 13 commits into from
Jan 28, 2025

Conversation

egillax
Copy link
Collaborator

@egillax egillax commented Jan 21, 2025

  • code that lets users plug in scikit learn models into the PLP framework

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 92.23301% with 8 lines in your changes missing coverage. Please review.

Project coverage is 87.54%. Comparing base (a6e87de) to head (a5b8994).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
R/ParamChecks.R 84.44% 7 Missing ⚠️
R/HelperFunctions.R 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #531      +/-   ##
===========================================
+ Coverage    87.44%   87.54%   +0.09%     
===========================================
  Files           49       50       +1     
  Lines        10913    10967      +54     
===========================================
+ Hits          9543     9601      +58     
+ Misses        1370     1366       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@egillax
Copy link
Collaborator Author

egillax commented Jan 24, 2025

@jreps I've made a PR from your branch with the code to convert a sklearn model to PLP.

  • I simplified the covariateMapping, AFAIK we don't need any sort of covariateNames associated with the sklearn model. In sklearn there's no info about the features saved with the model. We just need to map from our OHDSI covariateIds to the correct column the sklearn model expects. I added a test using reticulate and sklearn to train a model and test that predictions are identical between PLP and sklearn:

    expect_equal(mean(prediction$value), mean(externalPredictions))

  • Added quite thorough tests and checks.

  • I simplified naming - got rid of redundancy and added more explicit shorter names where possible (IMO).

  • Some minor unrelated changes with regards to helpers and parameter checks.

Please review and let me know what you think!

@egillax egillax requested a review from jreps January 24, 2025 13:22
@jreps
Copy link
Collaborator

jreps commented Jan 27, 2025

Looks good to me! Nice idea with removing the names for simplicity.

@egillax egillax merged commit bf9b9b5 into develop Jan 28, 2025
10 checks passed
@egillax egillax deleted the issue_503 branch January 28, 2025 07:11
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.

2 participants