Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Nov 14, 2024
1 parent dfe3b59 commit 070e47f
Show file tree
Hide file tree
Showing 81 changed files with 2,529 additions and 45 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ importFrom(mlr3,LearnerClassif)
importFrom(mlr3,LearnerRegr)
importFrom(mlr3,lrn)
importFrom(mlr3,lrns)
importFrom(mlr3,marshal_model)
importFrom(mlr3,mlr_learners)
importFrom(mlr3,unmarshal_model)
importFrom(stats,as.formula)
importFrom(stats,formula)
importFrom(stats,na.omit)
Expand Down
2 changes: 0 additions & 2 deletions R/helpers_rweka.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ rweka_predict = function(newdata, pars, predict_type, model) {
}

#' @export
#' @method marshal_model.Weka_classifier
marshal_model.Weka_classifier = function(model, inplace = FALSE, ...) {
rJava::.jcache(model$classifier)
structure(list(
Expand All @@ -68,7 +67,6 @@ marshal_model.Weka_classifier = function(model, inplace = FALSE, ...) {
}

#' @export
#' @method unmarshal_model.Weka_classifier_marshaled
unmarshal_model.Weka_classifier_marshaled = function(model, inplace = FALSE, ...) {
model$marshaled
}
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_IBk.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,33 @@ LearnerClassifIBk = R6Class("LearnerClassifIBk",
feature_types = c("numeric", "factor", "ordered", "integer"),
predict_types = c("response", "prob"),
param_set = ps,
properties = c("twoclass", "multiclass"),
properties = c("twoclass", "multiclass", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.IBk",
label = "Nearest Neighbour"
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_J48.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,33 @@ LearnerClassifJ48 = R6Class("LearnerClassifJ48",
feature_types = c("numeric", "factor", "ordered", "integer"),
predict_types = c("response", "prob"),
param_set = ps,
properties = c("twoclass", "multiclass", "missings"),
properties = c("twoclass", "multiclass", "missings", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.J48",
label = "Tree-based Model"
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_JRip.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,33 @@ LearnerClassifJRip = R6Class("LearnerClassifJRip",
feature_types = c("numeric", "factor", "ordered", "integer"),
predict_types = c("response", "prob"),
param_set = ps,
properties = c("twoclass", "multiclass"),
properties = c("twoclass", "multiclass", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.JRip",
label = "Propositional Rule Learner."
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_LMT.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,33 @@ LearnerClassifLMT = R6Class("LearnerClassifLMT",
feature_types = c("numeric", "factor", "ordered", "integer"),
predict_types = c("response", "prob"),
param_set = ps,
properties = c("twoclass", "multiclass"),
properties = c("twoclass", "multiclass", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.LMT",
label = "Tree-based Model"
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_OneR.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,33 @@ LearnerClassifOneR = R6Class("LearnerClassifOneR",
feature_types = c("numeric", "factor", "ordered", "integer"),
predict_types = c("response", "prob"),
param_set = ps,
properties = c("twoclass", "multiclass"),
properties = c("twoclass", "multiclass", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.OneR",
label = "One Rule"
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_PART.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,33 @@ LearnerClassifPART = R6Class("LearnerClassifPART",
feature_types = c("numeric", "factor", "ordered", "integer"),
predict_types = c("response", "prob"),
param_set = ps,
properties = c("twoclass", "multiclass", "missings"),
properties = c("twoclass", "multiclass", "missings", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.PART",
label = "Tree-based Model"
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_bayes_net.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,33 @@ LearnerClassifBayesNet = R6Class("LearnerClassifBayesNet",
feature_types = c("logical", "integer", "numeric", "factor", "ordered"),
predict_types = c("response", "prob"),
param_set = param_set,
properties = c("missings", "multiclass", "twoclass"),
properties = c("missings", "multiclass", "twoclass", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.bayes_net",
label = "Bayes Network"
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_decision_stump.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,33 @@ LearnerClassifDecisionStump = R6Class("LearnerClassifDecisionStump",
feature_types = c("logical", "integer", "numeric", "factor", "ordered"),
predict_types = c("response", "prob"),
param_set = param_set,
properties = c("missings", "multiclass", "twoclass"),
properties = c("missings", "multiclass", "twoclass", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.decision_stump",
label = "Decision Stump"
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_decision_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,33 @@ LearnerClassifDecisionTable = R6Class("LearnerClassifDecisionTable",
feature_types = c("logical", "integer", "numeric", "factor", "ordered"),
predict_types = c("response", "prob"),
param_set = param_set,
properties = c("missings", "multiclass", "twoclass"),
properties = c("missings", "multiclass", "twoclass", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.decision_table",
label = "Decision Table"
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
25 changes: 24 additions & 1 deletion R/learner_RWeka_classif_kstar.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,33 @@ LearnerClassifKStar = R6Class("LearnerClassifKStar",
feature_types = c("logical", "integer", "numeric", "factor", "ordered"),
predict_types = c("response", "prob"),
param_set = param_set,
properties = c("missings", "multiclass", "twoclass"),
properties = c("missings", "multiclass", "twoclass", "marshal"),
man = "mlr3extralearners::mlr_learners_classif.kstar",
label = "KStar"
)
},

#' @description
#' Marshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`marshal_model()`].
marshal = function(...) {
learner_marshal(.learner = self, ...)
},
#' @description
#' Unmarshal the learner's model.
#' @param ... (any)\cr
#' Additional arguments passed to [`unmarshal_model()`].
unmarshal = function(...) {
learner_unmarshal(.learner = self, ...)
}
),

active = list(
#' @field marshaled (`logical(1)`)\cr
#' Whether the learner has been marshaled.
marshaled = function() {
learner_marshaled(self)
}
),

Expand Down
Loading

0 comments on commit 070e47f

Please sign in to comment.