Skip to content

Commit

Permalink
BREAKING CHANGE: remove loglik method from all learnres
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Nov 13, 2024
1 parent d9954ff commit c194f1b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 33 deletions.
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# mlr3learners (development version)

* feat: update hyperparameter set of `lrn("classif.ranger")` and `lrn("regr.ranger")` for 0.17.0, adding `na.action` parameter and `"missings"` property, and `poisson` splitrule for regression with a new `poisson.tau` parameter.
* BREACKING CHANGE: Remove ``$loglik()`` method from all learners.
* feat: Update hyperparameter set of `lrn("classif.ranger")` and `lrn("regr.ranger")` for 0.17.0, adding `na.action` parameter and `"missings"` property, and `poisson` splitrule for regression with a new `poisson.tau` parameter.
* compatibility: mlr3 0.22.0.


# mlr3learners 0.8.0

* fix: Hyperparameter set of `lrn("classif.ranger")` and `lrn("regr.ranger")`.
Expand Down
8 changes: 1 addition & 7 deletions R/LearnerClassifLogReg.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,11 @@ LearnerClassifLogReg = R6Class("LearnerClassifLogReg",
param_set = ps,
predict_types = c("response", "prob"),
feature_types = c("logical", "integer", "numeric", "character", "factor", "ordered"),
properties = c("weights", "twoclass", "loglik"),
properties = c("weights", "twoclass"),
packages = c("mlr3learners", "stats"),
label = "Logistic Regression",
man = "mlr3learners::mlr_learners_classif.log_reg"
)
},

#' @description
#' Extract the log-likelihood (e.g., via [stats::logLik()] from the fitted model.
loglik = function() {
extract_loglik(self)
}
),

Expand Down
8 changes: 1 addition & 7 deletions R/LearnerClassifMultinom.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,11 @@ LearnerClassifMultinom = R6Class("LearnerClassifMultinom",
param_set = ps,
predict_types = c("response", "prob"),
feature_types = c("logical", "integer", "numeric", "factor"),
properties = c("weights", "twoclass", "multiclass", "loglik"),
properties = c("weights", "twoclass", "multiclass"),
packages = c("mlr3learners", "nnet"),
label = "Multinomial Log-Linear Model",
man = "mlr3learners::mlr_learners_classif.multinom"
)
},

#' @description
#' Extract the log-likelihood (e.g., via [stats::logLik()] from the fitted model.
loglik = function() {
extract_loglik(self)
}
),

Expand Down
8 changes: 1 addition & 7 deletions R/LearnerRegrLM.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,11 @@ LearnerRegrLM = R6Class("LearnerRegrLM",
param_set = ps,
predict_types = c("response", "se"),
feature_types = c("logical", "integer", "numeric", "factor", "character"),
properties = c("weights", "loglik"),
properties = "weights",
packages = c("mlr3learners", "stats"),
label = "Linear Model",
man = "mlr3learners::mlr_learners_regr.lm"
)
},

#' @description
#' Extract the log-likelihood (e.g., via [stats::logLik()] from the fitted model.
loglik = function() {
extract_loglik(self)
}
),

Expand Down
10 changes: 0 additions & 10 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,4 @@ rename = function(x, old, new) {
x
}


extract_loglik = function(self) {
require_namespaces(self$packages)
if (is.null(self$model)) {
stopf("Learner '%s' has no model stored", self$id)
}
stats::logLik(self$model)
}


opts_default_contrasts = list(contrasts = c("contr.treatment", "contr.poly"))

0 comments on commit c194f1b

Please sign in to comment.