@@ -115,7 +115,7 @@ print.decision_tree <- function(x, ...) {
115115 cat(" Decision Tree Model Specification (" , x $ mode , " )\n\n " , sep = " " )
116116 model_printer(x , ... )
117117
118- if (! is.null(x $ method $ fit $ args )) {
118+ if (! is.null(x $ method $ fit $ args )) {
119119 cat(" Model fit template:\n " )
120120 print(show_call(x ))
121121 }
@@ -171,8 +171,8 @@ update.decision_tree <-
171171# ' @export
172172translate.decision_tree <- function (x , engine = x $ engine , ... ) {
173173 if (is.null(engine )) {
174- message(" Used `engine = 'ranger '` for translation." )
175- engine <- " ranger "
174+ message(" Used `engine = 'rpart '` for translation." )
175+ engine <- " rpart "
176176 }
177177
178178 x <- translate.default(x , engine , ... )
@@ -183,33 +183,12 @@ translate.decision_tree <- function(x, engine = x$engine, ...) {
183183 if (x $ engine == " spark" ) {
184184 if (x $ mode == " unknown" ) {
185185 stop(
186- " For spark random forests models, the mode cannot be 'unknown' " ,
186+ " For spark decision tree models, the mode cannot be 'unknown' " ,
187187 " if the specification is to be translated." ,
188188 call. = FALSE
189189 )
190190 }
191-
192- # See "Details" in ?ml_random_forest_classifier. `feature_subset_strategy`
193- # should be character even if it contains a number.
194- if (any(names(arg_vals ) == " feature_subset_strategy" ) &&
195- isTRUE(is.numeric(quo_get_expr(arg_vals $ feature_subset_strategy )))) {
196- arg_vals $ feature_subset_strategy <-
197- paste(quo_get_expr(arg_vals $ feature_subset_strategy ))
198- }
199- }
200-
201- # add checks to error trap or change things for this method
202- if (engine == " ranger" ) {
203- if (any(names(arg_vals ) == " importance" ))
204- if (isTRUE(is.logical(quo_get_expr(arg_vals $ importance ))))
205- stop(" `importance` should be a character value. See ?ranger::ranger." ,
206- call. = FALSE )
207- # unless otherwise specified, classification models are probability forests
208- if (x $ mode == " classification" && ! any(names(arg_vals ) == " probability" ))
209- arg_vals $ probability <- TRUE
210-
211191 }
212- x $ method $ fit $ args <- arg_vals
213192
214193 x
215194}
0 commit comments