Skip to content

Commit

Permalink
Merge pull request #441 from sebp/sklearn-1-4
Browse files Browse the repository at this point in the history
Add support for scikit-learn 1.4
  • Loading branch information
sebp authored Apr 2, 2024
2 parents 02f748d + 90f4ce2 commit 764ef79
Show file tree
Hide file tree
Showing 32 changed files with 942 additions and 403 deletions.
40 changes: 18 additions & 22 deletions .github/workflows/tests-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,20 @@ jobs:
fail-fast: false
matrix:
config:
- py39_pandas14_numpy122_sklearn13
- py310_pandas15_numpy124_sklearn13
- py311_pandas20_numpy124_sklearn13
- py312_pandas21_numpy126_sklearn13
- py39
- py310
- py311
- py312
runner:
- ubuntu-latest
- macos-latest
- macos-14
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Adding conda to PATH
run: echo "${CONDA}/bin" >> $GITHUB_PATH
- name: Set dependencies
id: dependencies
run: |
Expand All @@ -37,23 +35,23 @@ jobs:
echo "CI_NUMPY_VERSION=${CI_NUMPY_VERSION}" >> $GITHUB_ENV
echo "CI_SKLEARN_VERSION=${CI_SKLEARN_VERSION}" >> $GITHUB_ENV
echo "CI_NO_SLOW=${CI_NO_SLOW}" >> $GITHUB_ENV
echo "CONDA_PKGS_DIR=${HOME}/conda_pkgs_dir" >> $GITHUB_ENV
echo "CONDA_PKGS_DIRS=${{ runner.temp }}/conda_pkgs_dir" >> $GITHUB_ENV
echo "py_version=$(cut -d'.' -f 1-2 <<< ${CI_PYTHON_VERSION})" >> $GITHUB_OUTPUT
echo "requirements=ci/deps/${{ matrix.config }}.sh" >> $GITHUB_OUTPUT
- name: Cache downloaded packages
uses: actions/cache@v4
with:
path: ${{ env.CONDA_PKGS_DIR }}
key: ${{ runner.os }}-conda-${{ steps.dependencies.outputs.py_version }}-${{ hashFiles(steps.dependencies.outputs.requirements, 'pyproject.toml', 'ci/deps/requirements.yaml.tmpl') }}
path: ${{ env.CONDA_PKGS_DIRS }}
key: ${{ runner.os }}-${{ runner.arch }}-conda-${{ steps.dependencies.outputs.py_version }}-${{ hashFiles(steps.dependencies.outputs.requirements, 'pyproject.toml', 'ci/deps/requirements.yaml.tmpl') }}
restore-keys: |
${{ runner.os }}-conda-${{ steps.dependencies.outputs.py_version }}-
${{ runner.os }}-${{ runner.arch }}-conda-${{ steps.dependencies.outputs.py_version }}-
- name: Create Conda Environment
run: |
sudo chown -R $USER $CONDA
ci/setup_env.sh ${{ runner.os }}
source ci/setup_conda.sh "${{ runner.os }}" "${{ runner.arch }}" "${{ env.CONDA_PKGS_DIRS }}"
ci/setup_env.sh "${{ runner.os }}"
- name: Configure Xcode
run: |
sudo xcode-select -s "/Applications/Xcode_13.2.1.app"
sudo xcode-select -s "/Applications/Xcode_15.0.1.app"
if: runner.os == 'macOS'
- name: Build package
run: |
Expand Down Expand Up @@ -99,30 +97,28 @@ jobs:
with:
fetch-depth: 0
submodules: true
- name: Adding conda to PATH
run: echo "${CONDA}/bin" >> $GITHUB_PATH
- name: Set dependencies
id: dependencies
env:
DEPS_CONFIG: py311_pandas20_numpy124_sklearn13
DEPS_CONFIG: py311
run: |
source ci/deps/${DEPS_CONFIG}.sh
echo "CI_PYTHON_VERSION=${CI_PYTHON_VERSION}" >> $GITHUB_ENV
echo "CI_PANDAS_VERSION=${CI_PANDAS_VERSION}" >> $GITHUB_ENV
echo "CI_NUMPY_VERSION=${CI_NUMPY_VERSION}" >> $GITHUB_ENV
echo "CI_SKLEARN_VERSION=${CI_SKLEARN_VERSION}" >> $GITHUB_ENV
echo "CI_NO_SLOW=${CI_NO_SLOW}" >> $GITHUB_ENV
echo "CONDA_PKGS_DIR=${HOME}/conda_pkgs_dir" >> $GITHUB_ENV
echo "CONDA_PKGS_DIRS=${{ runner.temp }}/conda_pkgs_dir" >> $GITHUB_ENV
echo "requirements=ci/deps/${DEPS_CONFIG}.sh" >> $GITHUB_OUTPUT
- name: Cache downloaded packages
uses: actions/cache@v4
with:
path: ${{ env.CONDA_PKGS_DIR }}
key: ${{ runner.os }}-conda-3.10-${{ hashFiles(steps.dependencies.outputs.requirements, 'pyproject.toml', 'ci/deps/requirements.yaml.tmpl') }}
path: ${{ env.CONDA_PKGS_DIRS }}
key: ${{ runner.os }}-${{ runner.arch }}-conda-3.11-${{ hashFiles(steps.dependencies.outputs.requirements, 'pyproject.toml', 'ci/deps/requirements.yaml.tmpl') }}
- name: Create Conda Environment
run: |
sudo chown -R $USER $CONDA
ci/setup_env.sh ${{ runner.os }}
source ci/setup_conda.sh "${{ runner.os }}" "${{ runner.arch }}" "${{ env.CONDA_PKGS_DIRS }}"
ci/setup_env.sh "${{ runner.os }}"
- name: Configure matplotlib
run: |
mkdir -p ${XDG_CONFIG_HOME}/matplotlib
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/tox-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ jobs:
uses: actions/checkout@v4
with:
submodules: true
- name: Install packages
- name: Install third-party tools
run: |
sudo apt-get install cmake libenchant-2-dev tox
sudo apt-get install cmake libenchant-2-dev
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install pandoc
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Tox
run: python -m pip install tox
- name: Run Tox
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Requirements
- ecos
- joblib
- numexpr
- numpy 1.17.3 or later
- numpy
- osqp
- pandas 1.0.5 or later
- scikit-learn 1.3
- scipy 1.3.2 or later
- scikit-learn 1.4
- scipy
- C/C++ compiler

============
Expand Down Expand Up @@ -123,7 +123,7 @@ Please cite the following paper if you are using **scikit-survival**.
:alt: codecov

.. |Codacy| image:: https://api.codacy.com/project/badge/Grade/17242004cdf6422c9a1052bf1ec63104
:target: https://www.codacy.com/gh/sebp/scikit-survival/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=sebp/scikit-survival&amp;utm_campaign=Badge_Grade
:target: https://app.codacy.com/gh/sebp/scikit-survival/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade
:alt: Codacy Badge

.. |Docs| image:: https://readthedocs.org/projects/scikit-survival/badge/?version=latest
Expand Down
7 changes: 4 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ platform:

install:
- ps: $env:CONDA_INSTALL_LOCN="$env:USERPROFILE\Miniconda3"
- ps: Invoke-WebRequest -Uri https://repo.anaconda.com/miniconda/Miniconda3-py311_23.5.2-0-Windows-x86_64.exe -OutFile Miniconda3.exe
- ps: ( Get-FileHash -Algorithm SHA256 Miniconda3.exe ).Hash -eq '00e8370542836862d4c790aa8966f1d7344a8addd4b766004febcb23f40e2914'
- ps: Invoke-WebRequest -Uri https://repo.anaconda.com/miniconda/Miniconda3-py312_24.1.2-0-Windows-x86_64.exe -OutFile Miniconda3.exe
- ps: ( Get-FileHash -Algorithm SHA256 Miniconda3.exe ).Hash -eq 'ff53a36b7024f8398cbfd043020f1f662cd4c5c2095c0007ddb4348aa5459375'
- ps: Start-Process Miniconda3.exe -Wait -ArgumentList @('/S', '/InstallationType=JustMe', '/RegisterPython=1', '/D="$env:CONDA_INSTALL_LOCN"')
- ps: $env:Path += ";$env:CONDA_INSTALL_LOCN\Scripts;$env:CONDA_INSTALL_LOCN\Library\bin"
- ps: conda init powershell
- ps: conda config --set always_yes yes --set changeps1 no
- ps: conda config --set always_yes yes
- ps: conda config --set changeps1 no
- ps: conda config --set auto_update_conda false
- ps: conda config --set notify_outdated_conda false
# - ps: conda update --yes --quiet conda
Expand Down
4 changes: 2 additions & 2 deletions ci/appveyor/py310.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$env:CI_PYTHON_VERSION="3.10.*"
$env:CI_PANDAS_VERSION="1.5.*"
$env:CI_NUMPY_VERSION="1.24.*"
$env:CI_SKLEARN_VERSION="1.3.*"
$env:CI_NUMPY_VERSION="1.25.*"
$env:CI_SKLEARN_VERSION="1.4.*"
4 changes: 2 additions & 2 deletions ci/appveyor/py311.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$env:CI_PYTHON_VERSION="3.11.*"
$env:CI_PANDAS_VERSION="2.0.*"
$env:CI_NUMPY_VERSION="1.24.*"
$env:CI_SKLEARN_VERSION="1.3.*"
$env:CI_NUMPY_VERSION="1.25.*"
$env:CI_SKLEARN_VERSION="1.4.*"
4 changes: 2 additions & 2 deletions ci/appveyor/py312.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$env:CI_PYTHON_VERSION="3.12.*"
$env:CI_PANDAS_VERSION="2.1.*"
$env:CI_PANDAS_VERSION="2.2.*"
$env:CI_NUMPY_VERSION="1.26.*"
$env:CI_SKLEARN_VERSION="1.3.*"
$env:CI_SKLEARN_VERSION="1.4.*"
4 changes: 2 additions & 2 deletions ci/appveyor/py39.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$env:CI_PYTHON_VERSION="3.9.*"
$env:CI_PANDAS_VERSION="1.4.*"
$env:CI_NUMPY_VERSION="1.22.*"
$env:CI_SKLEARN_VERSION="1.3.*"
$env:CI_NUMPY_VERSION="1.25.*"
$env:CI_SKLEARN_VERSION="1.4.*"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shellcheck shell=sh
export CI_PYTHON_VERSION='3.10.*'
export CI_PANDAS_VERSION='1.5.*'
export CI_NUMPY_VERSION='1.24.*'
export CI_SKLEARN_VERSION='1.3.*'
export CI_NUMPY_VERSION='1.25.*'
export CI_SKLEARN_VERSION='1.4.*'
export CI_NO_SLOW=true
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shellcheck shell=sh
export CI_PYTHON_VERSION='3.11.*'
export CI_PANDAS_VERSION='2.0.*'
export CI_NUMPY_VERSION='1.24.*'
export CI_SKLEARN_VERSION='1.3.*'
export CI_NUMPY_VERSION='1.25.*'
export CI_SKLEARN_VERSION='1.4.*'
export CI_NO_SLOW=true
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shellcheck shell=sh
export CI_PYTHON_VERSION='3.12.*'
export CI_PANDAS_VERSION='2.1.*'
export CI_PANDAS_VERSION='2.2.*'
export CI_NUMPY_VERSION='1.26.*'
export CI_SKLEARN_VERSION='1.3.*'
export CI_SKLEARN_VERSION='1.4.*'
export CI_NO_SLOW=false
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shellcheck shell=sh
export CI_PYTHON_VERSION='3.9.*'
export CI_PANDAS_VERSION='1.4.*'
export CI_NUMPY_VERSION='1.22.*'
export CI_SKLEARN_VERSION='1.3.*'
export CI_NUMPY_VERSION='1.25.*'
export CI_SKLEARN_VERSION='1.4.*'
export CI_NO_SLOW=false
4 changes: 2 additions & 2 deletions ci/deps/requirements.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ dependencies:
- pip
- pytest
- python={CI_PYTHON_VERSION}
- scikit-learn={CI_SKLEARN_VERSION}
- scipy>=1.3.2
- scipy>=1.6.0
- seaborn>=0.11.2,<0.12
- setuptools-scm
- wheel
Expand All @@ -26,4 +25,5 @@ dependencies:
- build
- importlib-resources>=1.3
- nbval>=0.10.0
- scikit-learn=={CI_SKLEARN_VERSION}
- tomli
59 changes: 59 additions & 0 deletions ci/setup_conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

RUNNER_OS="${1}"
RUNNER_ARCH="${2}"
CONDA_PKGS_DIR="${3}"

run_check_sha() {
echo "${1}" | shasum -a 256 --check --strict -
}

if [[ "${CONDA:-}" = "" ]]; then
# download and install conda
MINICONDA_VERSION="Miniconda3-py312_24.1.2-0"

if [[ "${RUNNER_OS}" = "macOS" ]] && [[ "${RUNNER_ARCH}" = "ARM64" ]]; then
MINICONDA_VERSION="${MINICONDA_VERSION}-MacOSX-arm64"
MINICONDA_HASH="1c277b1ec046fd1b628390994e3fa3dbac0e364f44cd98b915daaa67a326c66a"
elif [[ "${RUNNER_OS}" = "macOS" ]] && [[ "${RUNNER_ARCH}" = "X64" ]]; then
MINICONDA_VERSION="${MINICONDA_VERSION}-MacOSX-x86_64"
MINICONDA_HASH="bc45a2ceea9341579532847cc9f29a9769d60f12e306bba7f0de6ad5acdd73e9"
elif [[ "${RUNNER_OS}" = "Linux" ]] && [[ "${RUNNER_ARCH}" = "X64" ]]; then
MINICONDA_VERSION="${MINICONDA_VERSION}-Linux-x86_64"
MINICONDA_HASH="b978856ec3c826eb495b60e3fffe621f670c101150ebcbdeede4f961f22dc438"
else
echo "Unsupported OS or ARCH: ${RUNNER_OS} ${RUNNER_ARCH}"
exit 1
fi

export CONDA="${GITHUB_WORKSPACE}/miniconda3"

mkdir -p "${CONDA}" && \
curl "https://repo.anaconda.com/miniconda/${MINICONDA_VERSION}.sh" -o "${CONDA}/miniconda.sh" && \
run_check_sha "${MINICONDA_HASH} ${CONDA}/miniconda.sh" && \
bash "${CONDA}/miniconda.sh" -b -u -p "${CONDA}" && \
rm -rf "${CONDA}/miniconda.sh" || exit 1

echo "CONDA=${CONDA}" >> "${GITHUB_ENV}"
fi

"${CONDA}/bin/conda" config --set always_yes yes && \
"${CONDA}/bin/conda" config --set changeps1 no && \
"${CONDA}/bin/conda" config --set auto_update_conda false && \
"${CONDA}/bin/conda" config --set show_channel_urls true || \
exit 1

# The directory in which packages are located.
# https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/settings.html#pkgs-dirs-specify-package-directories
if [[ ! -d "${CONDA_PKGS_DIR}" ]]; then
mkdir -p "${CONDA_PKGS_DIR}" || exit 1
fi
sudo chown -R "${USER}" "${CONDA_PKGS_DIR}" || \
exit 1

sudo "${CONDA}/bin/conda" update -q -n base conda && \
sudo chown -R "${USER}" "${CONDA}" || \
exit 1

export PATH="${CONDA}/bin:${PATH}"
echo "${CONDA}/bin" >> "${GITHUB_PATH}"
10 changes: 2 additions & 8 deletions ci/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,15 @@ OS="$1"
if [ "x${OS}" = "xLinux" ]; then
COMPILER=()
elif [ "x${OS}" = "xmacOS" ]; then
COMPILER=(clang_osx-64 clangxx_osx-64)
COMPILER=(clang_osx-arm64 clangxx_osx-arm64)
else
echo "OS '${OS}' is unsupported."
exit 1
fi

#conda update -q conda
conda config --set always_yes yes --set changeps1 no
conda config --add pkgs_dirs "${CONDA_PKGS_DIR:-conda_pkgs_dir}"

conda install -n base conda-libmamba-solver

python ci/render-requirements.py ci/deps/requirements.yaml.tmpl > environment.yaml

conda env create -n sksurv-test --solver=libmamba --file environment.yaml
conda env create -n sksurv-test --file environment.yaml

echo "numpy ${CI_NUMPY_VERSION:?}" > "${CONDA:?}/envs/sksurv-test/conda-meta/pinned"
echo "pandas ${CI_PANDAS_VERSION:?}" >> "${CONDA:?}/envs/sksurv-test/conda-meta/pinned"
Expand Down
6 changes: 3 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

from datetime import datetime
from datetime import datetime, UTC
from importlib.metadata import version as get_version
import inspect
import os
Expand Down Expand Up @@ -85,7 +85,7 @@

# General information about the project.
project = "scikit-survival"
current_year = datetime.utcnow().year
current_year = datetime.now(UTC).year
copyright = f"2015-{current_year}, Sebastian Pölsterl and contributors"

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -209,7 +209,7 @@
}

intersphinx_mapping = {
"sklearn": ("https://scikit-learn.org/1.3", None),
"sklearn": ("https://scikit-learn.org/1.4", None),
"cython": ("https://cython.readthedocs.io/en/latest/", None),
}

Expand Down
6 changes: 3 additions & 3 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ The current minimum dependencies to run scikit-survival are:
- ecos
- joblib
- numexpr
- numpy 1.17.3 or later
- numpy
- osqp
- pandas 1.0.5 or later
- scikit-learn 1.3
- scipy 1.3.2 or later
- scikit-learn 1.4
- scipy
- C/C++ compiler
18 changes: 8 additions & 10 deletions doc/user_guide/boosting.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 764ef79

Please sign in to comment.