Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5d05cde
feat!: establish phase 1-2 fit API migration foundation (#33)
psychelzh Mar 13, 2026
f92b9d9
refactor: complete phase-3 polish for cpm_spec + fit API (#35)
psychelzh Mar 13, 2026
5d81e3b
feat: roll out native-first fit API and result objects (#49)
psychelzh Mar 16, 2026
f91ea58
docs: restore pkgdown news navigation
psychelzh Mar 16, 2026
4e2de00
refactor: align utility file names
psychelzh Mar 16, 2026
5010af5
refactor: group source files by responsibility
psychelzh Mar 16, 2026
5a6a794
Update documentation
psychelzh Mar 16, 2026
169dd8b
refactor: lead files with primary entry points
psychelzh Mar 16, 2026
24f2f72
refactor: colocate native fit helpers with cpm_spec
psychelzh Mar 16, 2026
5904626
refactor: extract shared prediction and resample helpers
psychelzh Mar 16, 2026
fb9eb36
refactor: drop direct native fit wrappers
psychelzh Mar 16, 2026
17a32d1
refactor: unify resample helper utilities
psychelzh Mar 16, 2026
d57a7c1
docs: refresh vignette workflow guidance
psychelzh Mar 16, 2026
8eb8e10
feat: redesign resample summary metrics
psychelzh Mar 16, 2026
ae888dc
docs: refresh resample summary guidance
psychelzh Mar 16, 2026
2748a43
fix: refine resample summary printing
psychelzh Mar 16, 2026
cce638d
feat: add resample_metrics helper
psychelzh Mar 16, 2026
3fd18ee
docs: document resample_metrics access
psychelzh Mar 16, 2026
c5138f0
refactor: clarify resample correlation parameter
psychelzh Mar 16, 2026
cdd66c5
refactor: scope correlation method handling
psychelzh Mar 16, 2026
10f7de5
docs: refine summary and workflow wording
psychelzh Mar 17, 2026
c910fc7
style: align user-facing messages
psychelzh Mar 17, 2026
7deb488
docs: improve help text and examples
psychelzh Mar 17, 2026
70af120
test: restore fit-model coverage
psychelzh Mar 17, 2026
5f6f8a4
test: reduce repeated resample fixtures
psychelzh Mar 17, 2026
bbf0cf2
style: refine printed model output
psychelzh Mar 17, 2026
0c1d0b2
refactor: unify summary metric tables
psychelzh Mar 17, 2026
fa62d03
docs: clarify summary metric access in vignettes
psychelzh Mar 17, 2026
93d41a6
Add touchstone benchmark CI
psychelzh Mar 21, 2026
959ecaf
Add standardized resample benchmark
psychelzh Mar 22, 2026
2ca306b
Unify CPM workflow around spec() and cpm()
psychelzh Mar 27, 2026
20b72d6
Drop the cpm_spec() compatibility wrapper
psychelzh Mar 28, 2026
289482b
Add repo skill and pkgdown validation gate
psychelzh Mar 28, 2026
ff59722
Default to summed edge storage
psychelzh Mar 28, 2026
3299a61
Replace resample_metrics() with tidy() metric tables
psychelzh Mar 28, 2026
913b53b
Trim static parameters from tidy tables
psychelzh Mar 28, 2026
628ccd6
Simplify R file layout around CPM workflow
psychelzh Mar 28, 2026
1b28797
Simplify fold-based CPM workflow and reporting
psychelzh Mar 29, 2026
3417151
Use spec()/cpm() touchstone workflows on unified branch
psychelzh Mar 29, 2026
f2db3ff
Refresh NEWS and development skill guidance
psychelzh Mar 29, 2026
6e264ce
Simplify CPM print output boundaries
psychelzh Mar 29, 2026
6a568f3
Rename strength construction and realign tests
psychelzh Mar 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@
^[.]?air[.]toml$
^\.vscode$
^touchstone$
^doc$
^Meta$
^touchstone$
^\.agents($|/)
45 changes: 45 additions & 0 deletions .agents/skills/cpmr-r-development/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: cpmr-r-development
description: Use when working in the cpmr repository to preserve its spec()/cpm() API, staged CPM configuration, direct internal flow, AIR formatting, pkgdown site checks, full test coverage, and final devtools::check() validation.
---

# cpmr R Development

Use this skill for code, tests, docs, review, and release-quality validation in this repository.

## API and design rules

- Public entry points are `spec()` and `cpm()`. Do not reintroduce `fit()`, `fit_resamples()`, `cpm_spec()`, or `cpm_resamples()`.
- Keep CPM model definition separate from execution settings.
`spec()` holds staged CPM choices; `cpm()` holds runtime settings such as `resamples`, `covariates`, `return_edges`, and `na_action`.
- Keep validation and normalization at public constructors and workflow entry points. Internal runtime paths should trust staged objects instead of re-validating them.
- Prefer direct, stepwise code. Avoid extra helper layers unless they remove real duplication or clarify a stable boundary.
- Private helpers should usually come after their primary callers so the main workflow reads top-down.
- Keep `tests/testthat` aligned with the current `R/` module boundaries. When `R/` files are merged, renamed, or deleted, rename or regroup the corresponding tests so the test layout does not preserve outdated file or concept names. If several source files are intentionally collapsed into one module, collapse the corresponding tests too instead of preserving the older split.
- After user-facing API, workflow, summary, or documentation changes, review `NEWS.md` against the current `main` branch. Keep only entries that are still true for the branch being worked on, and remove stale wording carried over from abandoned designs.
- Version changes are release tasks, not routine development chores. Use `usethis::use_version()` when preparing a release bump, and `usethis::use_dev_version()` when starting the next development cycle after a release. During ordinary development, do not change the development version unless explicitly asked.

## CPM architecture

- Treat CPM as a staged workflow: screen edges, summarize selected signal, then fit the outcome model.
- The default user workflow is fold-based through `cpm()`.
- Keep train-only computations leakage-safe. Anything learned from training data and reused at assessment time belongs in the fitted runtime state, not in public configuration.

## Code quality flow

Run this sequence after meaningful changes:

1. `devtools::document()`
2. `devtools::test()`
3. `pkgdown::build_site(preview = FALSE, install = TRUE)`
4. `cov <- covr::package_coverage()`
5. `covr::percent_coverage(cov)` must be `100`
6. If coverage is short, inspect `covr::zero_coverage(cov)` and close the gap
7. `devtools::check()`

## Tooling notes

- Format with `air`, for example `air format .` or `air format R/file.R`.
- Because this repository tracks pkgdown configuration, update `_pkgdown.yml` when exported topics or public narratives change.
- On Windows, use Quarto or the RStudio-bundled Pandoc if `devtools::check()` or `pkgdown` needs Pandoc.
- Build the pkgdown site with installation enabled when vignettes call `library(cpmr)`.
4 changes: 4 additions & 0 deletions .agents/skills/cpmr-r-development/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface:
display_name: "cpmr R Development"
short_description: "Use for cpmr API and validation workflows."
default_prompt: "Use this skill when working in the cpmr repository. Preserve the public spec()/cpm() API, keep staged CPM configuration separate from runtime settings, prefer direct stepwise code over extra helper layers, and validate changes with air, devtools::document(), devtools::test(), pkgdown::build_site(preview = FALSE, install = TRUE), 100% coverage, then devtools::check()."
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Keep repository text files on LF across platforms.
* text=auto eol=lf

# Treat common package artifacts as binary.
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.pdf binary
*.rds binary
*.RData binary
46 changes: 46 additions & 0 deletions .github/workflows/document.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
paths: ["R/**"]

name: document.yaml

permissions: read-all

jobs:
document:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::roxygen2
needs: roxygen2

- name: Document
run: roxygen2::roxygenise()
shell: Rscript {0}

- name: Commit and push changes
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add man/\* NAMESPACE DESCRIPTION
git commit -m "Update documentation" || echo "No changes to commit"
git pull --ff-only
git push origin
1 change: 0 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ jobs:
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
.DS_Store
.quarto
docs
/doc/
/Meta/
.agents/*
!.agents/skills/
!.agents/skills/cpmr-r-development/
!.agents/skills/cpmr-r-development/**
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Description: Connectome Predictive Modelling (CPM) (Shen et al. (2017)
License: MIT + file LICENSE
URL: https://github.com/psychelzh/cpmr, https://psychelzh.github.io/cpmr/
BugReports: https://github.com/psychelzh/cpmr/issues
Depends:
R (>= 4.4.0)
Imports:
generics,
Rfast,
Expand All @@ -21,10 +23,10 @@ Suggests:
rmarkdown,
testthat (>= 3.0.0),
withr
VignetteBuilder:
VignetteBuilder:
knitr
Config/testthat/edition: 3
Config/testthat/parallel: true
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Generated by roxygen2: do not edit by hand

S3method(print,cpm)
S3method(print,cpm_spec)
S3method(print,cpm_summary)
S3method(summary,cpm)
S3method(tidy,cpm)
export(cpm)
export(cpm_construction_strength)
export(cpm_model_lm)
export(cpm_selection_cor)
export(spec)
export(tidy)
importFrom(generics,tidy)
26 changes: 24 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
# cpmr (development version)

## Breaking changes

* `cpm()` now uses a staged specification created by `spec()`. The old
`thresh_method`, `thresh_level`, `kfolds`, and `bias_correct` arguments have
been replaced by `spec`, `resamples`, and staged helper constructors.
* Removed the deprecated `confounds` alias. Use `covariates` instead.
* The returned `cpm` object now stores workflow state under `spec`,
`settings`, `predictions`, and `folds`. Code that accessed the old
`real`, `pred`, or `params` fields must be updated.

## Enhancements

* Clarified `print.cpm()` output when edges are not stored and hardened `summary.cpm()` fold fallback for legacy objects.
* Added `spec()` together with `cpm_selection_cor()`,
`cpm_construction_strength()`, and `cpm_model_lm()` to make screening,
summarization, and outcome-model choices explicit.
* `cpm()` now accepts integer or manual assessment plans through `resamples`,
while keeping leave-one-out assessment as the default when `resamples` is
`NULL`.
* `summary.cpm()` and `tidy.cpm()` now focus on correlation-based reporting,
with pooled and fold-wise correlation tables plus optional edge summaries.
* Reworked package documentation and pkgdown navigation around the
`spec()` + `cpm()` workflow, including a native getting-started vignette.

## Maintenance

* Stabilized GitHub Actions uploads for Codecov coverage and Test Analytics by generating and uploading JUnit test results from an explicit workspace path.
* Simplified the internal CPM workflow around fold-based execution and aligned
`tests/testthat` with the current `R/` modules.
* Hardened assessment-fold validation and leakage-safe preprocessing so each
fold must retain at least 3 complete-case training observations.

# cpmr 0.1.1

Expand Down
2 changes: 0 additions & 2 deletions R/constants.R

This file was deleted.

Loading
Loading