Skip to content

Commit

Permalink
Merge branch 'master' into s3params_compat
Browse files Browse the repository at this point in the history
  • Loading branch information
mb706 committed Feb 28, 2024
2 parents ab349f2 + ed6c351 commit 8292395
Show file tree
Hide file tree
Showing 175 changed files with 2,132 additions and 1,070 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/dev-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- {os: ubuntu-latest, r: 'release', dev-package: 'mlr-org/mlr3'}

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

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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand All @@ -44,7 +44,7 @@ jobs:

- name: Deploy
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
2 changes: 1 addition & 1 deletion .github/workflows/r-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- {os: ubuntu-latest, r: 'release'}

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

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

Expand Down
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: mlr3proba
Title: Probabilistic Supervised Learning for 'mlr3'
Version: 0.5.8
Version: 0.6.0
Authors@R:
c(person(given = "Raphael",
family = "Sonabend",
Expand Down Expand Up @@ -79,12 +79,12 @@ Encoding: UTF-8
LazyData: true
NeedsCompilation: no
Roxygen: list(markdown = TRUE, r6 = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1.9000
Collate:
'LearnerDens.R'
'aaa.R'
'LearnerDensHistogram.R'
'LearnerDensKDE.R'
'LearnerRegrGaussian.R'
'LearnerSurv.R'
'LearnerSurvCoxPH.R'
'LearnerSurvKaplan.R'
Expand Down Expand Up @@ -135,11 +135,11 @@ Collate:
'PredictionSurv.R'
'RcppExports.R'
'TaskDens.R'
'TaskDens_X.R'
'TaskDens_zzz.R'
'TaskGeneratorSimdens.R'
'TaskGeneratorSimsurv.R'
'TaskSurv.R'
'TaskSurv_X.R'
'TaskSurv_zzz.R'
'as_prediction_dens.R'
'as_prediction_surv.R'
'as_task_dens.R'
Expand Down
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ export(as_task_dens)
export(as_task_surv)
export(assert_surv)
export(breslow)
export(crankcompositor)
export(distrcompositor)
export(pecs)
export(pipeline_survtoregr)
export(plot_probregr)
Expand All @@ -118,6 +116,7 @@ importFrom(stats,reformulate)
importFrom(stats,sd)
importFrom(survival,Surv)
importFrom(utils,data)
importFrom(utils,getFromNamespace)
importFrom(utils,head)
importFrom(utils,tail)
useDynLib(mlr3proba)
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# mlr3proba 0.6.0

* Optimized `surv.logloss` and `calib_alpha` measures (bypassing `distr6`)
* Update/refine all measure docs (namign conventions from upcoming scoring rules paper) + doc templates
* fix very rare bugs in `calib_alpha`, `surv.logloss` and `surv.graf` (version with proper = FALSE)

# mlr3proba 0.5.9

* Fix several old issues (#348, #301, #281)
* `distrcompositor` and `crankcompositor` deprecated functions were completely removed

# mlr3proba 0.5.8

* Fix Breslow issues (`phash` warning and `Inf` lp predictions)
Expand Down
3 changes: 3 additions & 0 deletions R/LearnerDensHistogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ LearnerDensHistogram = R6::R6Class("LearnerDensHistogram",
}
)
)

#' @include aaa.R
register_learner("dens.hist", LearnerDensHistogram)
4 changes: 3 additions & 1 deletion R/LearnerDensKDE.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' @template dens_learner
#' @templateVar title Kernel
#' @templateVar fullname LearnerDensKDE
#' @templateVar caller kernels implemented in \CRANpkg{distr6}
#' @templateVar caller kernels implemented in [distr6]
#' @details The default bandwidth uses Silverman's rule-of-thumb for Gaussian kernels, however for
#' non-Gaussian kernels it is recommended to use \CRANpkg{mlr3tuning} to tune the bandwidth with
#' cross-validation. Other density learners can be used for automated bandwidth selection.
Expand Down Expand Up @@ -88,3 +88,5 @@ LearnerDensKDE = R6::R6Class("LearnerDensKDE",
}
)
)

register_learner("dens.kde", LearnerDensKDE)
33 changes: 0 additions & 33 deletions R/LearnerRegrGaussian.R

This file was deleted.

2 changes: 1 addition & 1 deletion R/LearnerSurv.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' * Creates [Prediction]s of class [PredictionSurv].
#' * Possible values for `predict_types` are:
#' - `"distr"`: Predicts a probability distribution for each observation in the test set,
#' uses \CRANpkg{distr6}.
#' uses [distr6].
#' - `"lp"`: Predicts a linear predictor for each observation in the test set.
#' - `"crank"`: Predicts a continuous ranking for each observation in the test set.
#' - `"response"`: Predicts a survival time for each observation in the test set.
Expand Down
7 changes: 4 additions & 3 deletions R/LearnerSurvCoxPH.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#' @template surv_learner
#' @templateVar title Cox Proportional Hazards
#' @templateVar fullname LearnerSurvCoxPH
#' @templateVar caller [survival::coxph()]
#' @templateVar distr by [survival::survfit.coxph()]
#' @templateVar lp by [survival::predict.coxph()]
#' @description
#'
#' @templateVar id surv.coxph
#' @template surv_learner
#'
#' @references
#' `r format_bib("cox_1972")`
Expand Down Expand Up @@ -71,3 +70,5 @@ LearnerSurvCoxPH = R6Class("LearnerSurvCoxPH",
}
)
)

register_learner("surv.coxph", LearnerSurvCoxPH)
14 changes: 6 additions & 8 deletions R/LearnerSurvKaplan.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#' @template surv_learner
#' @templateVar title Kaplan-Meier Estimator
#' @templateVar fullname LearnerSurvKaplan
#' @templateVar caller [survival::survfit()]
#' @templateVar distr by estimating the survival function with [survival::survfit()]
#'
#' @description
#'
#' @templateVar id surv.kaplan
#' @template surv_learner
#'
#' @references
#' `r format_bib("kaplan_1958")`
Expand Down Expand Up @@ -35,13 +33,13 @@ LearnerSurvKaplan = R6Class("LearnerSurvKaplan",
},

.predict = function(task) {

# Define WeightedDiscrete distr6 distribution from the survival function
times = self$model$time
surv = matrix(rep(self$model$surv, task$nrow), ncol = length(times), nrow = task$nrow,
byrow = TRUE)
surv = matrix(rep(self$model$surv, task$nrow), ncol = length(times),
nrow = task$nrow, byrow = TRUE)

.surv_return(times = times, surv = surv)
}
)
)

register_learner("surv.kaplan", LearnerSurvKaplan)
12 changes: 8 additions & 4 deletions R/LearnerSurvRpart.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#' @template surv_learner
#' @templateVar title Rpart Survival Trees
#' @templateVar fullname LearnerSurvRpart
#' @templateVar caller [rpart::rpart()]
#' @templateVar crank using [rpart::predict.rpart()]
#' @templateVar id surv.rpart
#' @template surv_learner
#'
#' @description
#' Parameter `xval` is set to 0 in order to save some computation time.
#' Parameter `model` has been renamed to `keep_model`.
#' @section Initial parameter values:
#'
#' - `xval` is set to 0 in order to save some computation time.
#' - `model` has been renamed to `keep_model`.
#'
#' @references
#' `r format_bib("breiman_1984")`
Expand Down Expand Up @@ -87,3 +89,5 @@ LearnerSurvRpart = R6Class("LearnerSurvRpart",
}
)
)

register_learner("surv.rpart", LearnerSurvRpart)
11 changes: 6 additions & 5 deletions R/MeasureDensLogloss.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#' @template dens_measure
#' @templateVar title Log loss
#' @templateVar title Log Loss
#' @templateVar inherit [MeasureDens]
#' @templateVar fullname MeasureDensLogloss
#' @templateVar pars eps = 1e-15
#' @templateVar eps_par TRUE
#'
#' @templateVar eps 1e-15
#' @template param_eps
#'
#' @description
#' Calculates the cross-entropy, or logarithmic (log), loss.
#'
#' The logloss, in the context of probabilistic predictions, is defined as the negative log
#' @details
#' The Log Loss, in the context of probabilistic predictions, is defined as the negative log
#' probability density function, \eqn{f}, evaluated at the observed value, \eqn{y},
#' \deqn{L(f, y) = -\log(f(y))}{L(f, y) = -log(f(y))}
#'
Expand Down Expand Up @@ -47,3 +46,5 @@ MeasureDensLogloss = R6::R6Class("MeasureDensLogloss",
}
)
)

register_measure("dens.logloss", MeasureDensLogloss)
11 changes: 6 additions & 5 deletions R/MeasureRegrLogloss.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#' @template regr_measure
#' @templateVar title Log loss
#' @templateVar title Log Loss
#' @templateVar inherit [MeasureRegr]
#' @templateVar fullname MeasureRegrLogloss
#' @templateVar pars eps = 1e-15
#' @templateVar eps_par TRUE
#'
#' @templateVar eps 1e-15
#' @template param_eps
#'
#' @description
#' Calculates the cross-entropy, or logarithmic (log), loss.
#'
#' The logloss, in the context of probabilistic predictions, is defined as the negative log
#' @details
#' The Log Loss, in the context of probabilistic predictions, is defined as the negative log
#' probability density function, \eqn{f}, evaluated at the observed value, \eqn{y},
#' \deqn{L(f, y) = -\log(f(y))}{L(f, y) = -log(f(y))}
#'
Expand Down Expand Up @@ -54,3 +53,5 @@ MeasureRegrLogloss = R6::R6Class("MeasureRegrLogloss",
}
)
)

register_measure("regr.logloss", MeasureRegrLogloss)
3 changes: 2 additions & 1 deletion R/MeasureSurv.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#' @template param_packages
#' @template param_label
#' @template param_man
#' @template param_se
#'
#' @family Measure
#' @seealso
Expand All @@ -32,6 +31,8 @@ MeasureSurv = R6Class("MeasureSurv",
public = list(
#' @description
#' Creates a new instance of this [R6][R6::R6Class] class.
#' @param se If `TRUE` then returns standard error of the
#' measure otherwise returns the mean (default).
initialize = function(id, param_set = ps(), range, minimize = NA, aggregator = NULL,
properties = character(), predict_type = "distr", task_properties = character(),
packages = character(), label = NA_character_, man = NA_character_, se = FALSE) {
Expand Down
Loading

0 comments on commit 8292395

Please sign in to comment.