Skip to content

Commit

Permalink
Merged origin/main into mcanouil-fix/typos-hier_clust
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed Jan 27, 2025
2 parents 2094406 + a928d70 commit f9fbd4c
Show file tree
Hide file tree
Showing 97 changed files with 1,310 additions and 915 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:

name: R-CMD-check
name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
Expand All @@ -25,21 +28,25 @@ jobs:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}
# use 4.0 or 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: 'oldrel-4'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
#- {os: ubuntu-latest, r: 'oldrel-4'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
CXX14: g++
CXX14STD: -std=c++1y
CXX14FLAGS: -Wall -g -02

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -57,3 +64,8 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
10 changes: 7 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ on:
types: [published]
workflow_dispatch:

name: pkgdown
name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
Expand All @@ -19,8 +21,10 @@ jobs:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -39,7 +43,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
issue_comment:
types: [created]

name: Commands
name: pr-commands.yaml

permissions: read-all

jobs:
document:
Expand All @@ -13,8 +15,10 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down Expand Up @@ -50,8 +54,10 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
pull_request:
branches: [main, master]

name: test-coverage
name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
Expand All @@ -15,36 +17,45 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
covr::codecov(
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ Depends:
R (>= 3.6)
Imports:
cli (>= 3.0.0),
dials (>= 1.1.0),
dials (>= 1.3.0),
dplyr (>= 1.0.9),
flexclust (>= 1.3-6),
foreach,
generics (>= 0.1.2),
glue (>= 1.6.2),
hardhat (>= 1.0.0),
modelenv (>= 0.1.0),
modelenv (>= 0.2.0.9000),
parsnip (>= 1.0.2),
philentropy (>= 0.9.0),
prettyunits (>= 1.1.0),
Rfast (>= 2.0.6),
rlang (>= 1.0.6),
rsample (>= 1.0.0),
stats,
Expand All @@ -49,6 +49,8 @@ Suggests:
rmarkdown,
testthat (>= 3.0.0),
workflows (>= 1.1.2)
Remotes:
tidymodels/modelenv
Config/Needs/website: pkgdown, tidymodels, tidyverse, palmerpenguins,
patchwork, ggforce, tidyverse/tidytemplate
Config/testthat/edition: 3
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# tidyclust (development version)

* The philentropy package is now used to calculate distances rather than Rfast. (#199)

# tidyclust 0.2.3

* Update to fix revdep issue for clustMixType. (#190)
Expand Down
46 changes: 38 additions & 8 deletions R/aaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,47 @@

utils::globalVariables(
c(
".", "..object", ".cluster", ".iter_config", ".iter_model",
".iter_preprocessor", ".msg_model", ".submodels", "call_info", "cluster",
"component", "component_id", "compute_intercept", "data", "dist", "engine",
"engine2", "exposed", "func", "id", "iteration", "lab", "name", "neighbor",
"new_data", "object", "orig_label", "original", "predictor_indicators",
"remove_intercept", "seed", "sil_width", "splits", "tunable", "type",
"value", "x", "y"
".",
"..object",
".cluster",
".iter_config",
".iter_model",
".iter_preprocessor",
".msg_model",
".submodels",
"call_info",
"cluster",
"component",
"component_id",
"compute_intercept",
"data",
"dist",
"engine",
"engine2",
"exposed",
"func",
"id",
"iteration",
"lab",
"name",
"neighbor",
"new_data",
"object",
"orig_label",
"original",
"predictor_indicators",
"remove_intercept",
"seed",
"sil_width",
"splits",
"tunable",
"type",
"value",
"x",
"y"
)
)


release_bullets <- function() {
c(
"Run `knit_engine_docs()` and `devtools::document()` to update docs"
Expand Down
54 changes: 30 additions & 24 deletions R/append.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# https://github.com/tidymodels/tune/blob/main/R/pull.R#L136
append_predictions <- function(collection,
predictions,
split,
control,
.config = NULL) {
append_predictions <- function(
collection,
predictions,
split,
control,
.config = NULL
) {
if (!control$save_pred) {
return(NULL)
}
Expand All @@ -27,14 +29,16 @@ append_predictions <- function(collection,
dplyr::bind_rows(collection, predictions)
}

append_metrics <- function(workflow,
collection,
predictions,
metrics,
param_names,
event_level,
split,
.config = NULL) {
append_metrics <- function(
workflow,
collection,
predictions,
metrics,
param_names,
event_level,
split,
.config = NULL
) {
if (inherits(predictions, "try-error")) {
return(collection)
}
Expand All @@ -54,20 +58,22 @@ append_metrics <- function(workflow,
dplyr::bind_rows(collection, tmp_est)
}

append_extracts <- function(collection,
workflow,
grid,
split,
ctrl,
.config = NULL) {
append_extracts <- function(
collection,
workflow,
grid,
split,
ctrl,
.config = NULL
) {
extracts <-
grid %>%
dplyr::bind_cols(labels(split)) %>%
dplyr::mutate(
.extracts = list(
extract_details(workflow, ctrl$extract)
dplyr::bind_cols(labels(split)) %>%
dplyr::mutate(
.extracts = list(
extract_details(workflow, ctrl$extract)
)
)
)

if (!rlang::is_null(.config)) {
extracts <- cbind(extracts, .config)
Expand Down
Loading

0 comments on commit f9fbd4c

Please sign in to comment.