diff --git a/.github/workflows/R_CMD_check_Hades.yaml b/.github/workflows/R_CMD_check_Hades.yaml index 27dcc8d23..b85c0c946 100644 --- a/.github/workflows/R_CMD_check_Hades.yaml +++ b/.github/workflows/R_CMD_check_Hades.yaml @@ -22,7 +22,7 @@ jobs: config: - {os: windows-latest, r: 'release'} # Does not appear to have Java 32-bit, hence the --no-multiarch - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-22.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"} env: GITHUB_PAT: ${{ secrets.GH_TOKEN }} @@ -46,28 +46,14 @@ jobs: steps: - uses: actions/checkout@v2 - - - uses: conda-incubator/setup-miniconda@v2 - with: - python-version: "3.7" - activate-environment: r-reticulate - - - name: python main dependencies - run: conda install --name r-reticulate numpy scipy scikit-learn pandas pydotplus joblib - - - name: python json dependencies - run: conda install --name r-reticulate -c conda-forge sklearn-json - - - name: python scikit-survival dependencies - run: conda install --name r-reticulate -c sebp scikit-survival - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} - - uses: r-lib/actions/setup-tinytex@v1 + - uses: r-lib/actions/setup-tinytex@v2 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - name: Install system requirements if: runner.os == 'Linux' @@ -77,17 +63,17 @@ jobs: while read -r cmd do eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') + done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "22.04"))') + + - name: Setup conda + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: "r-reticulate" - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::rcmdcheck needs: check - - - name: use r-reticulate environment - run: | - reticulate::use_condaenv("r-reticulate", required = TRUE) - shell: Rscript {0} - uses: r-lib/actions/check-r-package@v2 with: diff --git a/DESCRIPTION b/DESCRIPTION index 73929b7e0..5b1b0dcc2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: PatientLevelPrediction Type: Package Title: Developing patient level prediction using data in the OMOP Common Data Model -Version: 6.3.4 +Version: 6.3.5.9000 Date: 2023-08-15 Authors@R: c( person("Jenna", "Reps", email = "jreps@its.jnj.com", role = c("aut", "cre")), diff --git a/NEWS.md b/NEWS.md index 33ce2fe7d..be5c6e18f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +PatientLevelPrediction 6.3.5 +====================== +- Fix sklearnToJson to be compatible with scikit-learn>=1.3 +- Fix github actions so it's not hardcoded to use python 3.7 + + PatientLevelPrediction 6.3.4 ====================== - added spline feature engineering diff --git a/R/SklearnToJson.R b/R/SklearnToJson.R index 9c1dba1ae..2a2771338 100644 --- a/R/SklearnToJson.R +++ b/R/SklearnToJson.R @@ -89,7 +89,11 @@ deSerializeTree <- function(tree_dict, nFeatures, nClasses, nOutputs) { reticulate::tuple(reticulate::py_to_r(tree_dict["nodes"][i]))) } - names = list("left_child", "right_child", "feature", "threshold", "impurity", "n_node_samples", "weighted_n_node_samples") + names <- list("left_child", "right_child", "feature", "threshold", "impurity", "n_node_samples", "weighted_n_node_samples") + if (length(tree_dict["nodes"][0])==8) { + # model used sklearn>=1.3 which added a parameter + names[[8]] <- "missing_go_to_left" + } sklearn <- reticulate::import("sklearn") np <- reticulate::import("numpy", convert = FALSE) diff --git a/README.md b/README.md index 52a2ac8bc..838a82cff 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ System Requirements Requires R (version 4.0 or higher). Installation on Windows requires [RTools](http://cran.r-project.org/bin/windows/Rtools/). Libraries used in PatientLevelPrediction require Java and Python. The python installation is required for some of the machine learning algorithms. We advise to -install Python 3.7 using Anaconda (https://www.continuum.io/downloads). +install Python 3.8 or higher using Anaconda (https://www.continuum.io/downloads). Getting Started ===============