forked from tidymodels/parsnip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetails_decision_tree_spark.Rd
93 lines (85 loc) · 3.24 KB
/
details_decision_tree_spark.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/decision_tree_spark.R
\name{details_decision_tree_spark}
\alias{details_decision_tree_spark}
\title{Decision trees via Spark}
\description{
\code{\link[sparklyr:ml_decision_tree]{sparklyr::ml_decision_tree()}} fits a model as a set of \verb{if/then}
statements that creates a tree-based structure.
}
\details{
For this engine, there are multiple modes: classification and regression
\subsection{Tuning Parameters}{
This model has 2 tuning parameters:
\itemize{
\item \code{tree_depth}: Tree Depth (type: integer, default: 5L)
\item \code{min_n}: Minimal Node Size (type: integer, default: 1L)
}
}
\subsection{Translation from parsnip to the original package (classification)}{\if{html}{\out{<div class="sourceCode r">}}\preformatted{decision_tree(tree_depth = integer(1), min_n = integer(1)) \%>\%
set_engine("spark") \%>\%
set_mode("classification") \%>\%
translate()
}\if{html}{\out{</div>}}\preformatted{## Decision Tree Model Specification (classification)
##
## Main Arguments:
## tree_depth = integer(1)
## min_n = integer(1)
##
## Computational engine: spark
##
## Model fit template:
## sparklyr::ml_decision_tree_classifier(x = missing_arg(), formula = missing_arg(),
## max_depth = integer(1), min_instances_per_node = min_rows(0L,
## x), seed = sample.int(10^5, 1))
}
}
\subsection{Translation from parsnip to the original package (regression)}{\if{html}{\out{<div class="sourceCode r">}}\preformatted{decision_tree(tree_depth = integer(1), min_n = integer(1)) \%>\%
set_engine("spark") \%>\%
set_mode("regression") \%>\%
translate()
}\if{html}{\out{</div>}}\preformatted{## Decision Tree Model Specification (regression)
##
## Main Arguments:
## tree_depth = integer(1)
## min_n = integer(1)
##
## Computational engine: spark
##
## Model fit template:
## sparklyr::ml_decision_tree_regressor(x = missing_arg(), formula = missing_arg(),
## max_depth = integer(1), min_instances_per_node = min_rows(0L,
## x), seed = sample.int(10^5, 1))
}
}
\subsection{Preprocessing requirements}{
This engine does not require any special encoding of the predictors.
Categorical predictors can be partitioned into groups of factor levels
(e.g. \verb{\{a, c\}} vs \verb{\{b, d\}}) when splitting at a node. Dummy variables
are not required for this model.
}
\subsection{Other details}{
For models created using the \code{"spark"} engine, there are several things
to consider.
\itemize{
\item Only the formula interface to via \code{fit()} is available; using
\code{fit_xy()} will generate an error.
\item The predictions will always be in a Spark table format. The names
will be the same as documented but without the dots.
\item There is no equivalent to factor columns in Spark tables so class
predictions are returned as character columns.
\item To retain the model object for a new R session (via \code{save()}), the
\code{model$fit} element of the parsnip object should be serialized via
\code{ml_save(object$fit)} and separately saved to disk. In a new
session, the object can be reloaded and reattached to the parsnip
object.
}
}
\subsection{References}{
\itemize{
\item Kuhn, M, and K Johnson. 2013. \emph{Applied Predictive Modeling}.
Springer.
}
}
}
\keyword{internal}