OHDSI / PatientLevelPrediction

An R package for performing patient level prediction in an observational database in the OMOP Common Data Model.
https://ohdsi.github.io/PatientLevelPrediction
181 stars 88 forks source link

Newest reticulate breaks PLP #441

Closed egillax closed 2 months ago

egillax commented 2 months ago

Errors like this:

── Error ('test-sklearnClassifier.R:64:3'): check fit of DecisionTree ──────────
<python.builtin.TypeError/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
Error in `py_get_item(x, name)`: TypeError: 'module' object is not subscriptable
Run `reticulate::py_last_error()` for details.
Backtrace:
    ▆
 1. └─PatientLevelPrediction::fitPlp(...) at test-sklearnClassifier.R:64:3
 2.   ├─base::do.call(fun, args) at PatientLevelPrediction/R/Fit.R:84:3
 3.   └─PatientLevelPrediction (local) `<fn>`(...)
 4.     ├─base::do.call(...) at PatientLevelPrediction/R/SklearnClassifier.R:61:3
 5.     └─PatientLevelPrediction (local) `<fn>`(...)
 6.       ├─firstImport[[pythonImportSecond]] at PatientLevelPrediction/R/SklearnClassifier.R:254:5
 7.       └─reticulate:::`[[.python.builtin.object`(firstImport, pythonImportSecond) at PatientLevelPrediction/R/SklearnClassifier.R:254:5
 8.         └─reticulate:::py_get_attr_or_item(x, name, FALSE)
 9.           └─reticulate::py_get_item(x, name)
egillax commented 2 months ago

I fixed this. This was happening because the import of python modules was broken. Now each scikit-learn models saves the python module and python class it needs and the gridCvPython function imports them.

egillax commented 2 months ago

Fixed by #446