Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup and various fixes #357

Merged
merged 30 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
37b68f2
doc fix links: distr6 not in CRAN
bblodfon Jan 30, 2024
3759b41
fix: doc templates
bblodfon Jan 30, 2024
f80a333
update RoxygenNote
bblodfon Jan 30, 2024
5e54947
skip >10 sec test (dens.kde learner)
bblodfon Jan 30, 2024
74c0c26
pipeop fix: init values are not overwritten now
bblodfon Jan 30, 2024
26f7ded
fix: #348
bblodfon Jan 30, 2024
64d649e
rename test file
bblodfon Jan 31, 2024
e90ded7
collate zzz.R first for registering mlr3 stuff
bblodfon Jan 31, 2024
2dbbeff
register and unregister learners
bblodfon Jan 31, 2024
d1df966
add comment
bblodfon Jan 31, 2024
ff78836
register and unregister tasks
bblodfon Jan 31, 2024
06b4f6f
remove mock-up class (saved in bblodfon/mlr3tests)
bblodfon Jan 31, 2024
284e9d7
register and unregister measures
bblodfon Jan 31, 2024
fff98c1
test unloading
bblodfon Jan 31, 2024
eb53455
register and unregister task generators
bblodfon Jan 31, 2024
6e0923c
update mlr tasks docs
bblodfon Jan 31, 2024
633456b
change collate order by document()
bblodfon Jan 31, 2024
b143b16
register and unregister pipeops
bblodfon Jan 31, 2024
2040241
remove deprecated functions (distrcompositor, crankcompositor)
bblodfon Jan 31, 2024
ba9f5c1
register and unregister graphs (pipelines)
bblodfon Jan 31, 2024
7be2e14
skip density test only offline
bblodfon Jan 31, 2024
4b844f5
remove deprecated functions from pkgdown
bblodfon Jan 31, 2024
62b12bd
change skip function to avoid installing curl
bblodfon Jan 31, 2024
9a41709
remove deprecated params
bblodfon Jan 31, 2024
ecb7474
small refactoring
bblodfon Jan 31, 2024
14aeab8
remove triple quotes
bblodfon Jan 31, 2024
42ee837
fix: namespace couldn't be unloaded cleanly
bblodfon Jan 31, 2024
cd4c64d
doc fix: #281
bblodfon Jan 31, 2024
e30361f
udpate version
bblodfon Jan 31, 2024
d8190b4
Merge branch 'main' into cleanup
bblodfon Jan 31, 2024
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
11 changes: 5 additions & 6 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.5.9
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'
'zzz.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 All @@ -162,4 +162,3 @@ Collate:
'scoring_rule_erv.R'
'surv_measures.R'
'surv_return.R'
'zzz.R'
2 changes: 0 additions & 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 Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 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 zzz.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)
8 changes: 4 additions & 4 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 @@ -45,3 +43,5 @@ LearnerSurvKaplan = R6Class("LearnerSurvKaplan",
}
)
)

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)
2 changes: 2 additions & 0 deletions R/MeasureDensLogloss.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ MeasureDensLogloss = R6::R6Class("MeasureDensLogloss",
}
)
)

register_measure("dens.logloss", MeasureDensLogloss)
2 changes: 2 additions & 0 deletions R/MeasureRegrLogloss.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ MeasureRegrLogloss = R6::R6Class("MeasureRegrLogloss",
}
)
)

register_measure("regr.logloss", MeasureRegrLogloss)
2 changes: 2 additions & 0 deletions R/MeasureSurvCalibrationAlpha.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ MeasureSurvCalibrationAlpha = R6Class("MeasureSurvCalibrationAlpha",
}
)
)

register_measure("surv.calib_alpha", MeasureSurvCalibrationAlpha)
2 changes: 2 additions & 0 deletions R/MeasureSurvCalibrationBeta.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ MeasureSurvCalibrationBeta = R6Class("MeasureSurvCalibrationBeta",
}
)
)

register_measure("surv.calib_beta", MeasureSurvCalibrationBeta)
2 changes: 2 additions & 0 deletions R/MeasureSurvChamblessAUC.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ MeasureSurvChamblessAUC = R6Class("MeasureSurvChamblessAUC",
}
)
)

register_measure("surv.chambless_auc", MeasureSurvChamblessAUC)
2 changes: 2 additions & 0 deletions R/MeasureSurvCindex.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,5 @@ gonen = function(crank, tiex) {

c_gonen(sort(crank), tiex)
}

register_measure("surv.cindex", MeasureSurvCindex)
2 changes: 2 additions & 0 deletions R/MeasureSurvDCalibration.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ MeasureSurvDCalibration = R6Class("MeasureSurvDCalibration",
}
)
)

register_measure("surv.dcalib", MeasureSurvDCalibration)
3 changes: 3 additions & 0 deletions R/MeasureSurvGraf.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,6 @@ MeasureSurvGraf = R6::R6Class("MeasureSurvGraf",
}
)
)

register_measure("surv.graf", MeasureSurvGraf)
register_measure("surv.brier", MeasureSurvGraf)
2 changes: 2 additions & 0 deletions R/MeasureSurvHungAUC.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ MeasureSurvHungAUC = R6Class("MeasureSurvHungAUC",
}
)
)

register_measure("surv.hung_auc", MeasureSurvHungAUC)
2 changes: 2 additions & 0 deletions R/MeasureSurvIntLogloss.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,5 @@ MeasureSurvIntLogloss = R6::R6Class("MeasureSurvIntLogloss",
}
)
)

register_measure("surv.intlogloss", MeasureSurvIntLogloss)
2 changes: 2 additions & 0 deletions R/MeasureSurvLogloss.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ MeasureSurvLogloss = R6::R6Class("MeasureSurvLogloss",
}
)
)

register_measure("surv.logloss", MeasureSurvLogloss)
2 changes: 2 additions & 0 deletions R/MeasureSurvMAE.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ MeasureSurvMAE = R6::R6Class("MeasureSurvMAE",
}
)
)

register_measure("surv.mae", MeasureSurvMAE)
2 changes: 2 additions & 0 deletions R/MeasureSurvMSE.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ MeasureSurvMSE = R6::R6Class("MeasureSurvMSE",
}
)
)

register_measure("surv.mse", MeasureSurvMSE)
2 changes: 2 additions & 0 deletions R/MeasureSurvNagelkR2.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ MeasureSurvNagelkR2 = R6Class("MeasureSurvNagelkR2",
}
)
)

register_measure("surv.nagelk_r2", MeasureSurvNagelkR2)
2 changes: 2 additions & 0 deletions R/MeasureSurvOQuigleyR2.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ MeasureSurvOQuigleyR2 = R6Class("MeasureSurvOQuigleyR2",
}
)
)

register_measure("surv.oquigley_r2", MeasureSurvOQuigleyR2)
2 changes: 2 additions & 0 deletions R/MeasureSurvRCLL.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,5 @@ MeasureSurvRCLL = R6::R6Class("MeasureSurvRCLL",
}
)
)

register_measure("surv.rcll", MeasureSurvRCLL)
2 changes: 2 additions & 0 deletions R/MeasureSurvRMSE.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ MeasureSurvRMSE = R6::R6Class("MeasureSurvRMSE",
}
)
)

register_measure("surv.rmse", MeasureSurvRMSE)
2 changes: 2 additions & 0 deletions R/MeasureSurvSchmid.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ MeasureSurvSchmid = R6::R6Class("MeasureSurvSchmid",
}
)
)

register_measure("surv.schmid", MeasureSurvSchmid)
2 changes: 2 additions & 0 deletions R/MeasureSurvSongAUC.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ MeasureSurvSongAUC = R6Class("MeasureSurvSongAUC",
}
)
)

register_measure("surv.song_auc", MeasureSurvSongAUC)
2 changes: 2 additions & 0 deletions R/MeasureSurvSongTNR.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ MeasureSurvSongTNR = R6Class("MeasureSurvSongTNR",
}
)
)

register_measure("surv.song_tnr", MeasureSurvSongTNR)
2 changes: 2 additions & 0 deletions R/MeasureSurvSongTPR.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ MeasureSurvSongTPR = R6Class("MeasureSurvSongTPR",
}
)
)

register_measure("surv.song_tpr", MeasureSurvSongTPR)
2 changes: 2 additions & 0 deletions R/MeasureSurvUnoAUC.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ MeasureSurvUnoAUC = R6Class("MeasureSurvUnoAUC",
}
)
)

register_measure("surv.uno_auc", MeasureSurvUnoAUC)
2 changes: 2 additions & 0 deletions R/MeasureSurvUnoTNR.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ MeasureSurvUnoTNR = R6Class("MeasureSurvUnoTNR",
}
)
)

register_measure("surv.uno_tnr", MeasureSurvUnoTNR)
2 changes: 2 additions & 0 deletions R/MeasureSurvUnoTPR.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ MeasureSurvUnoTPR = R6Class("MeasureSurvUnoTPR",
}
)
)

register_measure("surv.uno_tpr", MeasureSurvUnoTPR)
2 changes: 2 additions & 0 deletions R/MeasureSurvXuR2.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ MeasureSurvXuR2 = R6Class("MeasureSurvXuR2",
}
)
)

register_measure("surv.xu_r2", MeasureSurvXuR2)
16 changes: 9 additions & 7 deletions R/PipeOpCrankCompositor.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @title PipeOpCrankCompositor
#' @name mlr_pipeops_compose_crank
#' @name mlr_pipeops_crankcompose
#' @template param_pipelines
#'
#' @description
Expand Down Expand Up @@ -47,7 +47,7 @@
#'
#' @section Internals:
#' The `median`, `mode`, or `mean` will use analytical expressions if possible but if not they are
#' calculated using methods from \CRANpkg{distr6}. `mean` requires \CRANpkg{cubature}.
#' calculated using methods from [distr6]. `mean` requires \CRANpkg{cubature}.
#'
#' @seealso [pipeline_crankcompositor]
#' @family survival compositors
Expand Down Expand Up @@ -75,20 +75,20 @@ PipeOpCrankCompositor = R6Class("PipeOpCrankCompositor",
public = list(
#' @description
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function(id = "compose_crank", param_vals = list(
method = "sum_haz", response = FALSE, overwrite = FALSE)) {
ps = ps(
initialize = function(id = "crankcompose", param_vals = list()) {
param_set = ps(
method = p_fct(default = "sum_haz", levels = c("sum_haz", "mean", "median", "mode"),
tags = "predict"),
which = p_int(default = 1, lower = 1, tags = "predict"),
response = p_lgl(default = FALSE, tags = "predict"),
overwrite = p_lgl(default = FALSE, tags = "predict")
)
ps$add_dep("which", "method", CondEqual$new("mode"))
param_set$add_dep("which", "method", CondEqual$new("mode"))
param_set$values = list(method = "sum_haz", response = FALSE, overwrite = FALSE)

super$initialize(
id = id,
param_set = ps,
param_set = param_set,
param_vals = param_vals,
input = data.table(name = "input", train = "NULL", predict = "PredictionSurv"),
output = data.table(name = "output", train = "NULL", predict = "PredictionSurv"),
Expand Down Expand Up @@ -185,3 +185,5 @@ PipeOpCrankCompositor = R6Class("PipeOpCrankCompositor",
}
)
)

register_pipeop("crankcompose", PipeOpCrankCompositor)
Loading
Loading