Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…tion into develop
  • Loading branch information
jreps committed Sep 7, 2023
2 parents 5a08d8a + 5df21d7 commit bf871cc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 26 deletions.
32 changes: 9 additions & 23 deletions .github/workflows/R_CMD_check_Hades.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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'
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 5 additions & 1 deletion R/SklearnToJson.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
===============
Expand Down

0 comments on commit bf871cc

Please sign in to comment.