Skip to content

Commit

Permalink
Merge pull request #74 from brandmaier/merging_tbrick_boruta
Browse files Browse the repository at this point in the history
merging tbrick changes
  • Loading branch information
brandmaier authored Sep 5, 2024
2 parents 09638cd + a57768d commit e196b4b
Show file tree
Hide file tree
Showing 194 changed files with 3,420 additions and 2,822 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ Makefile
^pkgdown$
^LICENSE\.md$
^\.travis\.yml$
misc
cran-comments.md
^CRAN-SUBMISSION$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
29 changes: 29 additions & 0 deletions .github/workflows/R-CMD-check-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check-Win

jobs:
R-CMD-check:
runs-on: windows-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v3

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
29 changes: 29 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v3

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
17 changes: 17 additions & 0 deletions .github/workflows/R-devel-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# check package on latest R devel version
#
on: workflow-dispatch

name: R-CMD-check

jobs:
devel-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: 'devel'
# Use "renv" to retrieve R version recorded in renv.lock file.
- run: 'R CMD build ./'
- run: 'R CMD check semtree*.tar.gz'
31 changes: 31 additions & 0 deletions .github/workflows/R-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
workflow_dispatch

name: Tests

jobs:
document:
name: run tests
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2
extra-packages: |
any::testthat
any::devtools
# needs: pr-document
- name: install package
run: devtools::install_github("brandmaier/semtree")
shell: Rscript {0}

- name: run test
run: testthat::test_dir("tests/testthat/")
shell: Rscript {0}
50 changes: 50 additions & 0 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3

- 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
needs: coverage

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

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

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
inst/doc
doc
Meta
/doc/
/Meta/
cran_comments.md
CRAN*
.DS_Store

46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

19 changes: 8 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@ Depends:
R (>= 2.10),
OpenMx (>= 2.6.9),
Imports:
bitops,
sets,
digest,
rpart,
rpart.plot (>= 3.0.6),
plotrix,
cluster,
stringr,
lavaan,
cluster,
ggplot2,
tidyr,
methods,
Expand All @@ -30,7 +25,6 @@ Imports:
clisymbols,
future.apply,
data.table,
ctsemOMX,
expm,
gridBase
Suggests:
Expand All @@ -39,7 +33,9 @@ Suggests:
viridis,
MASS,
psychTools,
testthat
testthat,
future,
ctsemOMX
Description: SEM Trees and SEM Forests -- an extension of model-based decision
trees and forests to Structural Equation Models (SEM). SEM trees hierarchically
split empirical data into homogeneous groups each sharing similar data patterns
Expand All @@ -53,9 +49,10 @@ Description: SEM Trees and SEM Forests -- an extension of model-based decision
License: GPL-3
Encoding: UTF-8
LazyLoad: yes
Version: 0.9.19
Date: 2023-03-03
RoxygenNote: 7.3.1
Version: 0.9.20
Date: 2024-03-25
RoxygenNote: 7.2.3
VignetteBuilder: knitr
BugReports: https://github.com/brandmaier/semtree/issues
URL: https://github.com/brandmaier/semtree
Language: en-US
6 changes: 4 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ S3method(print,summary.semtree)
S3method(proximity,semforest)
S3method(proximity,semforest_node_id)
S3method(proximity,semforest_stripped)
S3method(prune,semforest)
S3method(prune,semtree)
S3method(strip,semforest)
S3method(strip,semtree)
S3method(summary,semforest)
S3method(summary,semtree)
S3method(toLatex,semtree)
export(biodiversity)
export(boruta)
export(diversityMatrix)
Expand Down Expand Up @@ -59,10 +61,12 @@ export(prune)
export(se)
export(semforest)
export(semforest.control)
export(semforest_control)
export(semforest_score_control)
export(semtree)
export(semtree.constraints)
export(semtree.control)
export(semtree_control)
export(strip)
export(subforest)
export(subtree)
Expand All @@ -72,7 +76,6 @@ export(varimpConvergencePlot)
import(OpenMx)
import(data.table)
import(rpart)
importFrom(bitops,bitAnd)
importFrom(data.table,data.table)
importFrom(grDevices,heat.colors)
importFrom(graphics,barplot)
Expand All @@ -92,7 +95,6 @@ importFrom(methods,is)
importFrom(parallel,clusterMap)
importFrom(parallel,parLapply)
importFrom(sandwich,bread)
importFrom(sets,as.set)
importFrom(stats,as.dist)
importFrom(stats,as.formula)
importFrom(stats,cmdscale)
Expand Down
18 changes: 13 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# semtree 0.9.20 (2023)
# semtree 0.9.20 (2024)

- changed default behavior of print function of varimp, such that na.omit=TRUE,
which is consistent with other packages like party or partykit
- added an error handler for score-based tests when the vcov matrix cannot be computed (e.g., models with Heywood cases)
- leaner package imports: removed dependency on bitops and stringr package
- prefer `semforest_control()` over `semforest.control()` and `semtree_control()` over `semtree.control()`
- added heuristics for choosing `mtry` in forests (if `NULL`) and for choosing `min.N` and `min.bucket` (if `NULL`)
- moved dependency on `ctsemOMX` to suggested package

# semtree 0.9.19 (2022)
# semtree 0.9.19 (2023)

- changed default behavior of print function of `varimp`, such that na.omit=TRUE, which is consistent with other packages like party or partykit
- fixed issues with `toTable()`-command, by default, all parameters are shown now, also fixed a bug with score-based tests and toTable()
- fixed problem with focus-parameters and variable importance
- bugfix in score-based tests that sometimes did not respect min.N constraints
- new functionality for parameter contribution evaluation
- more verbose vignettes
- removed dependency on set, plotrix and digest package to make package imports leaner

# semtree 0.9.18 (2022)

Expand Down Expand Up @@ -65,6 +73,6 @@
- deprecated partialDependencePlot and introduced partialDependence() function with S3 plotting method
- added parallel computation option to partialDependence
- added new demo scripts
- added extra.legend paramter to varimpConvergencePlot
- added extra.legend parameter to varimpConvergencePlot
- bugfix in traverse() that led to underestimations of variable importance in some cases
- added error message when trying to use lavaan and global constraints
19 changes: 19 additions & 0 deletions R/OpenMx_scores_input.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ OpenMx_scores_input <- function(x, control) {
p_star <- p * (p + 1) / 2
p_star_means <- p * (p + 3) / 2

# AB: give pseudo-labels to matrices if
# unlabelled parameters are given
candidate_param_id <- which(startsWith(x=names(x$output$estimate), prefix=x$name))
if (length(candidate_param_id)>0) {
for (k in candidate_param_id) {
candidate_param_name <- names(x$output$estimate)[k]
cplen <- nchar(x$name)
candidate_matrix <- substr(candidate_param_name, cplen+2,cplen+2)
candidate_pos <- as.integer(strsplit(substr(candidate_param_name, cplen+4, nchar(candidate_param_name)-1),",")[[1]])
if (candidate_matrix=="A") {
x$A$labels[candidate_pos[1], candidate_pos[2]]<-candidate_param_name
} else if (candidate_matrix=="S") {
x$S$labels[candidate_pos[1], candidate_pos[2]]<-candidate_param_name
} else if (candidate_matrix == "M") {
x$M$labels[candidate_pos]<-candidate_param_name
}
}
}

if (control$linear | imxHasDefinitionVariable(x)) {

param_names <- names(x$output$estimate)
Expand Down
1 change: 0 additions & 1 deletion R/aggregateVarimp.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

aggregateVarimp <-
function(vimp,
aggregate = "mean",
Expand Down
Loading

0 comments on commit e196b4b

Please sign in to comment.