Skip to content

Commit

Permalink
Merge branch with main
Browse files Browse the repository at this point in the history
Merge branch 'main' into clean_up

# Conflicts:
#	NAMESPACE
#	R/MainFunctions.R
  • Loading branch information
AniekMarkus committed Aug 30, 2023
2 parents d441465 + ed50e1a commit 95f62a0
Show file tree
Hide file tree
Showing 20 changed files with 260 additions and 134 deletions.
4 changes: 3 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
^\.lib$
^history$
^Report\.html$
^Report_files/$
^Report_files/$
^cran-comments\.md$
^codecov\.yml$
17 changes: 13 additions & 4 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, develop, OmmitedSrcFiles]
branches: [main, develop]
pull_request:
branches: [main, develop, OmmitedSrcFiles]
branches: [main, develop]

name: R-CMD-check

Expand All @@ -20,10 +20,9 @@ jobs:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
Expand All @@ -38,12 +37,22 @@ jobs:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- name: R dependencies
run: |
install.packages('remotes')
install.packages('knitr')
install.packages('testthat')
shell: Rscript {0}

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

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
error-on: '"error"'

50 changes: 50 additions & 0 deletions .github/workflows/test-coverage.yaml
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, develop]
pull_request:
branches: [main, develop]

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
20 changes: 11 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Package: Explore
Type: Package
Title: Exhaustive Procedure for LOgic-Rule Extraction
Version: 0.2.0
Title: Exhaustive Procedure for LOgic-Rule Extraction (EXPLORE)
Version: 0.3.0
Date: 2020-12-14
Author: Aniek F Markus
Maintainer: Aniek F Markus <[email protected]>
Description: This package includes the implementation of EXPLORE in C++ and connects it to R.
Authors@R: c(
person("Aniek", "Markus", , "[email protected]", role = c("aut"), comment = c(ORCID = "0000-0001-5779-4794")),
person("Cesar", "Barboza", , "[email protected]", role = c("cre", "aut"), comment = c(ORCID = "0009-0002-4453-3071"))
)
Description: This package is the R Implementation of the Exhaustive Procedure for LOgic-Rule Extraction (EXPLORE) in C++.
License: GPL (>= 2)
Depends:
R (>= 3.6.1)
R (>= 3.6.0)
Imports:
checkmate,
farff,
Expand All @@ -22,8 +24,8 @@ Suggests:
testthat (>= 3.0.0),
knitr,
rmarkdown,
withr
withr,
covr
VignetteBuilder: knitr
Config/testthat/edition: 3
URL: https://cbarbozaerasmus.github.io/Explore/
SystemRequirements: GNU make
URL: https://github.com/mi-erasmusmc/Explore
2 changes: 1 addition & 1 deletion Explore.Rproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
SaveWorkspace: No
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Explore 0.3.0

* Package tested on Windows, MacOs and Linux. R-CMD-Check without errors.

* Improved tests.

* Solving issues for CRAN release.

# Explore 0.2.0

* Added a `NEWS.md` file to track changes to the package.
Expand Down
17 changes: 10 additions & 7 deletions R/MainFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#' @param PositiveClass 1 or string (?) (should be one of elements of column 'ClassFeature' in data train). Always provided by the user. The string should be enclused in single quotation marks, e.g. 'class'
#' @param FeatureInclude Empty or string (should be name of one of columns in data train)
#' @param Maximize One of list with strings, list = "ACCURACY", "SENSITIVITY", "SPECIFICITY", ...
#' @param Accuracy Float 0-1 -> default = 0 (if 0, make empty = computationally more beneficial)
#' @param Specificity float 0-1, default = 0
#' @param Accuracy Float 0-0.999 -> default = 0 (if 0, make empty = computationally more beneficial)
#' @param Specificity float 0-0.999, default = 0
#' @param PrintSettings True or False
#' @param PrintPerformance True or False
#' @param Subsumption True or False
Expand All @@ -31,7 +31,7 @@
#' @importFrom RcppParallel RcppParallelLibs
trainExplore <- function(train_data = NULL,
settings_path = NULL,
output_path,
output_path = tempdir(),
file_name = "train_data",
OutputFile = NULL,
StartRulelength = 1,
Expand All @@ -49,16 +49,17 @@ trainExplore <- function(train_data = NULL,
Subsumption = TRUE,
BranchBound = TRUE,
Parallel = FALSE) {



if (!dir.exists(output_path)) {
dir.create(output_path, recursive = TRUE)
}

# Create output folder
if(!endsWith(output_path, "/")) {
warning("Output path should end with /, add this")
output_path <- paste0(output_path, "/")
}

if (!file.exists(output_path)) {dir.create(output_path, recursive = TRUE)}

# Variable checks
errorMessage <- makeAssertCollection()

Expand Down Expand Up @@ -106,6 +107,8 @@ trainExplore <- function(train_data = NULL,
Subsumption <- ifelse(Subsumption == TRUE, "yes", "no")
BranchBound <- ifelse(BranchBound == TRUE, "yes", "no")
Parallel <- ifelse(Parallel == TRUE, "yes", "no")
Accuracy <- ifelse(Accuracy == 0, "", Specificity)
Specificity <- ifelse(Specificity == 0, "", Specificity)

# Create project setting
if (is.null(settings_path)) {
Expand Down
6 changes: 6 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ out.width = "100%"
)
```

<!-- badges: start -->
[![R-CMD-check](https://github.com/mi-erasmusmc/Explore/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/mi-erasmusmc/Explore/actions/workflows/check-standard.yaml)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Codecov test coverage](https://codecov.io/github/mi-erasmusmc/Explore/branch/develop/graph/badge.svg)](https://app.codecov.io/github/mi-erasmusmc/Explore?branch=develop)
<!-- badges: end -->

## Package overview
Functions to find a short and accurate decision rule in disjunctive normal form using the Exhaustive Procedure for LOgic-Rule Extraction (EXPLORE) algorithm. The application performs and exhaustive search on all Boolean Normal Form decision rules.

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

<!-- badges: start -->
[![R-CMD-check](https://github.com/mi-erasmusmc/Explore/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/mi-erasmusmc/Explore/actions/workflows/check-standard.yaml)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Codecov test
coverage](https://codecov.io/github/mi-erasmusmc/Explore/branch/develop/graph/badge.svg)](https://app.codecov.io/github/mi-erasmusmc/Explore?branch=develop)
<!-- badges: end -->

## Package overview

Functions to find a short and accurate decision rule in disjunctive
Expand Down
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url: https://cbarbozaerasmus.github.io/Explore/
url: https://mi-erasmusmc.github.io/Explore/
template:
bootstrap: 5

14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
comment: false

coverage:
status:
project:
default:
target: auto
threshold: 1%
informational: true
patch:
default:
target: auto
threshold: 1%
informational: true
5 changes: 5 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## R CMD check results

0 errors | 0 warnings | 1 note

* This is a new release.
15 changes: 12 additions & 3 deletions man/Explore-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/trainExplore.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed src/C++/CMExplore/Debug/CMExplore.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion src/C++/CMExplore/main.h → src/C++/CMExplore/mainforR.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
IOExplore *MyIOExplore; // Input object
Explore *MyExplore; // Explore core object

int main(int argc, char* argv[]);
// int main(int argc, char* argv[]);

int mainforR(int argc, char* argv[]);

Expand Down
6 changes: 3 additions & 3 deletions src/ExploreInterface.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// [[Rcpp::depends(BH)]]
#include <Rcpp.h>
#include "C++/CMExplore/main.h"
#include "C++/CMExplore/mainforR.h"
#include "C++/CMExplore/initialise.h"
#include "../src/C++/Explore/explore.h"

Expand All @@ -23,7 +23,7 @@ void runExplore(Rcpp::CharacterVector input) {
int argc = (int)cstrings.size()+1;
char** argv = cstrings.data();

int res = main(argc, argv);
int res = mainforR(argc, argv);
}

/*** R
Expand All @@ -36,7 +36,7 @@ void runExplore(Rcpp::CharacterVector input) {
# runExplore(input)
*/

int main(int argc, char* argv[])
int mainforR(int argc, char* argv[])
{
ExploreSettings ProjectSettings;

Expand Down
2 changes: 1 addition & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makevars
CXX_STD = CXX11 -mmacosx-version-min=10.15

SOURCES=$(wildcard C++/*.cpp C++/IOExplore/*.cpp C++/Explore/*.cpp C++/CMExplore/*.cpp)
SOURCES= C++/common.cpp C++/IOExplore/IOExplore.cpp C++/Explore/bin.cpp C++/Explore/candidate.cpp C++/Explore/classdef.cpp C++/Explore/condition.cpp C++/Explore/conjunction.cpp C++/Explore/constraint.cpp C++/Explore/cutoff.cpp C++/Explore/explore.cpp C++/Explore/feature.cpp C++/Explore/mandatory.cpp C++/Explore/observation.cpp C++/Explore/partition.cpp C++/Explore/performance.cpp C++/Explore/population.cpp C++/Explore/roc.cpp C++/Explore/rocpair.cpp C++/Explore/rule.cpp C++/Explore/set.cpp C++/Explore/timing.cpp

OBJECTS = ExploreInterface.o RcppExports.o $(SOURCES:.cpp=.o)

Expand Down
6 changes: 3 additions & 3 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Makevars
CXX_STD = CXX11 # -mmacosx-version-min=10.15

SOURCES=$(wildcard C++/*.cpp C++/IOExplore/*.cpp C++/Explore/*.cpp C++/CMExplore/*.cpp)
SOURCES= C++/common.cpp C++/IOExplore/IOExplore.cpp C++/Explore/bin.cpp C++/Explore/candidate.cpp C++/Explore/classdef.cpp C++/Explore/condition.cpp C++/Explore/conjunction.cpp C++/Explore/constraint.cpp C++/Explore/cutoff.cpp C++/Explore/explore.cpp C++/Explore/feature.cpp C++/Explore/mandatory.cpp C++/Explore/observation.cpp C++/Explore/partition.cpp C++/Explore/performance.cpp C++/Explore/population.cpp C++/Explore/roc.cpp C++/Explore/rocpair.cpp C++/Explore/rule.cpp C++/Explore/set.cpp C++/Explore/timing.cpp

OBJECTS = ExploreInterface.o RcppExports.o $(SOURCES:.cpp=.o)

PKG_CXXFLAGS += -DRCPP_PARALLEL_USE_TBB=1
PKG_CXXFLAGS = -DRCPP_PARALLEL_USE_TBB=1

PKG_LIBS += $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "RcppParallel::RcppParallelLibs()")
PKG_LIBS = `"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "RcppParallel::RcppParallelLibs()"`

all: $(SHLIB)

Expand Down
Loading

0 comments on commit 95f62a0

Please sign in to comment.