Skip to content

Commit

Permalink
test with new paradox (#43)
Browse files Browse the repository at this point in the history
* test with new paradox

* a required parameter can not have a default.

* custom_check functions should return a string, not stop()

* workflow file

* dev cmd check with paradox master
  • Loading branch information
mb706 authored Mar 17, 2024
1 parent 29c80ff commit eedf186
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 6 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/dev-cmd-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Workflow sets WEKA_HOME and installs XMeans
# r cmd check workflow of the mlr3 ecosystem v0.3.1
# https://github.com/mlr-org/actions
on:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled'
required: false
default: false
push:
branches:
- main
pull_request:
branches:
- main

name: dev-check

env:
WEKA_HOME: /home/runner/work/mlr3cluster

jobs:
check-package:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.dev-package }}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release', dev-package: 'mlr-org/paradox'}

steps:
- uses: actions/checkout@v4

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

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

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

- uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
with:
limit-access-to-actor: true

- name: Install XMeans
run: |
RWeka::WPM("refresh-cache")
RWeka::WPM("install-package", "XMeans")
shell: Rscript {0}

- name: Install dev versions
run: pak::pkg_install(c('${{ matrix.config.dev-package }}'))
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Add DBSCAN learner from 'fpc' package
* Add HDBSCAN learner from 'dbscan' package
* Add OPTICS learner from 'dbscan' package
* Compatibility with upcoming 'paradox' release

# mlr3cluster 0.1.8

Expand Down
2 changes: 1 addition & 1 deletion R/LearnerClustCMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ LearnerClustCMeans = R6Class("LearnerClustCMeans",
initialize = function() {
param_set = ps(
centers = p_uty(
tags = c("required", "train"), default = 2L, custom_check = check_centers
tags = c("required", "train"), custom_check = check_centers
),
iter.max = p_int(1L, default = 100L, tags = "train"),
verbose = p_lgl(default = FALSE, tags = "train"),
Expand Down
2 changes: 1 addition & 1 deletion R/LearnerClustFanny.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LearnerClustFanny = R6Class("LearnerClustFanny",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
k = p_int(1L, default = 2L, tags = c("required", "train")),
k = p_int(1L, tags = c("required", "train")),
memb.exp = p_dbl(1, default = 2, tags = "train"),
metric = p_fct(default = "euclidean", levels = c("euclidean", "manhattan", "SqEuclidean"), tags = "train"),
stand = p_lgl(default = FALSE, tags = "train"),
Expand Down
2 changes: 1 addition & 1 deletion R/LearnerClustFeatureless.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LearnerClustFeatureless = R6Class("LearnerClustFeatureless",
#' @description
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(num_clusters = p_int(1L, default = 1L, tags = c("required", "train", "predict")))
param_set = ps(num_clusters = p_int(1L, tags = c("required", "train", "predict")))
param_set$set_values(num_clusters = 1L)

super$initialize(
Expand Down
2 changes: 1 addition & 1 deletion R/LearnerClustKKMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LearnerClustKKMeans = R6Class("LearnerClustKKMeans",
initialize = function() {
param_set = ps(
centers = p_uty(
tags = c("required", "train"), default = 2L, custom_check = check_centers
tags = c("required", "train"), custom_check = check_centers
),
kernel = p_fct(
default = "rbfdot",
Expand Down
2 changes: 1 addition & 1 deletion R/LearnerClustKMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ LearnerClustKMeans = R6Class("LearnerClustKMeans",
initialize = function() {
param_set = ps(
centers = p_uty(
tags = c("required", "train"), default = 2L, custom_check = check_centers
tags = c("required", "train"), custom_check = check_centers
),
iter.max = p_int(1L, default = 10L, tags = "train"),
algorithm = p_fct(
Expand Down
2 changes: 1 addition & 1 deletion R/LearnerClustPAM.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ LearnerClustPAM = R6Class("LearnerClustPAM",
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function() {
param_set = ps(
k = p_int(1L, default = 2L, tags = c("required", "train")),
k = p_int(1L, tags = c("required", "train")),
metric = p_fct(levels = c("euclidian", "manhattan"), tags = "train"),
medoids = p_uty(
default = NULL, tags = "train", custom_check = crate(function(x) check_integerish(x, null.ok = TRUE))
Expand Down
Binary file added tests/testthat/Rplots.pdf
Binary file not shown.

0 comments on commit eedf186

Please sign in to comment.