From dfe3b59bdd15f134fae68ce4d5fda8b81cbee82a Mon Sep 17 00:00:00 2001 From: be-marc Date: Thu, 14 Nov 2024 10:41:34 +0100 Subject: [PATCH] feat: marshall rweka models --- NAMESPACE | 2 +- R/helpers_rweka.R | 11 +++--- man/mlr_learners_classif.AdaBoostM1.Rd | 46 ++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 9eabd8c7f..e8c10be69 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,7 @@ # Generated by roxygen2: do not edit by hand S3method(marshal_model,Weka_classifier) -S3method(unmarshal_model,Weka_classifier) +S3method(unmarshal_model,Weka_classifier_marshaled) export(LearnerClassifAbess) export(LearnerClassifAdaBoostM1) export(LearnerClassifBart) diff --git a/R/helpers_rweka.R b/R/helpers_rweka.R index ab061ae99..fd9a0d1e7 100644 --- a/R/helpers_rweka.R +++ b/R/helpers_rweka.R @@ -59,17 +59,16 @@ rweka_predict = function(newdata, pars, predict_type, model) { #' @export #' @method marshal_model.Weka_classifier -marshal_model.Weka_classifier= function(model, inplace = FALSE, ...) { +marshal_model.Weka_classifier = function(model, inplace = FALSE, ...) { rJava::.jcache(model$classifier) - structure(list( - marshaled = model, packages = "mlr3extralearners"), - class = c("classif.Weka_classifier_marshaled", "marshaled") + marshaled = model, packages = c("mlr3", "mlr3extralearners")), + class = c("Weka_classifier_marshaled", "marshaled") ) } #' @export -#' @method unmarshal_model.Weka_classifier -unmarshal_model.Weka_classifier = function(model, inplace = FALSE, ...) { +#' @method unmarshal_model.Weka_classifier_marshaled +unmarshal_model.Weka_classifier_marshaled = function(model, inplace = FALSE, ...) { model$marshaled } diff --git a/man/mlr_learners_classif.AdaBoostM1.Rd b/man/mlr_learners_classif.AdaBoostM1.Rd index 34ebbbfc2..5c5159d0e 100644 --- a/man/mlr_learners_classif.AdaBoostM1.Rd +++ b/man/mlr_learners_classif.AdaBoostM1.Rd @@ -116,10 +116,20 @@ henrifnk \section{Super classes}{ \code{\link[mlr3:Learner]{mlr3::Learner}} -> \code{\link[mlr3:LearnerClassif]{mlr3::LearnerClassif}} -> \code{LearnerClassifAdaBoostM1} } +\section{Active bindings}{ +\if{html}{\out{
}} +\describe{ +\item{\code{marshaled}}{(\code{logical(1)})\cr +Whether the learner has been marshaled.} +} +\if{html}{\out{
}} +} \section{Methods}{ \subsection{Public methods}{ \itemize{ \item \href{#method-LearnerClassifAdaBoostM1-new}{\code{LearnerClassifAdaBoostM1$new()}} +\item \href{#method-LearnerClassifAdaBoostM1-marshal}{\code{LearnerClassifAdaBoostM1$marshal()}} +\item \href{#method-LearnerClassifAdaBoostM1-unmarshal}{\code{LearnerClassifAdaBoostM1$unmarshal()}} \item \href{#method-LearnerClassifAdaBoostM1-clone}{\code{LearnerClassifAdaBoostM1$clone()}} } } @@ -147,6 +157,42 @@ Creates a new instance of this \link[R6:R6Class]{R6} class. \if{html}{\out{
}}\preformatted{LearnerClassifAdaBoostM1$new()}\if{html}{\out{
}} } +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-LearnerClassifAdaBoostM1-marshal}{}}} +\subsection{Method \code{marshal()}}{ +Marshal the learner's model. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{LearnerClassifAdaBoostM1$marshal(...)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{...}}{(any)\cr +Additional arguments passed to \code{\link[=marshal_model]{marshal_model()}}.} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-LearnerClassifAdaBoostM1-unmarshal}{}}} +\subsection{Method \code{unmarshal()}}{ +Unmarshal the learner's model. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{LearnerClassifAdaBoostM1$unmarshal(...)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{...}}{(any)\cr +Additional arguments passed to \code{\link[=unmarshal_model]{unmarshal_model()}}.} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}}