-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy patharx_class_epi_workflow.Rd
69 lines (63 loc) · 2.77 KB
/
arx_class_epi_workflow.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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/arx_classifier.R
\name{arx_class_epi_workflow}
\alias{arx_class_epi_workflow}
\title{Create a template \code{arx_classifier} workflow}
\usage{
arx_class_epi_workflow(
epi_data,
outcome,
predictors,
trainer = parsnip::logistic_reg(),
args_list = arx_class_args_list()
)
}
\arguments{
\item{epi_data}{An \code{epi_df} object}
\item{outcome}{A character (scalar) specifying the outcome (in the
\code{epi_df}). Note that as with \code{\link[=arx_forecaster]{arx_forecaster()}}, this is expected to
be real-valued. Conversion of this data to unordered classes is handled
internally based on the \code{breaks} argument to \code{\link[=arx_class_args_list]{arx_class_args_list()}}.
If discrete classes are already in the \code{epi_df}, it is recommended to
code up a classifier from scratch using \code{\link[=epi_recipe]{epi_recipe()}}.}
\item{predictors}{A character vector giving column(s) of predictor variables.
This defaults to the \code{outcome}. However, if manually specified, only those variables
specifically mentioned will be used. (The \code{outcome} will not be added.)
By default, equals the outcome. If manually specified, does not add the
outcome variable, so make sure to specify it.}
\item{trainer}{A \code{{parsnip}} model describing the type of estimation. For
now, we enforce \code{mode = "classification"}. Typical values are
\code{\link[parsnip:logistic_reg]{parsnip::logistic_reg()}} or \code{\link[parsnip:multinom_reg]{parsnip::multinom_reg()}}. More complicated
trainers like \code{\link[parsnip:naive_Bayes]{parsnip::naive_Bayes()}} or \code{\link[parsnip:rand_forest]{parsnip::rand_forest()}} can also
be used. May be \code{NULL} if you'd like to decide later.}
\item{args_list}{A list of customization arguments to determine
the type of forecasting model. See \code{\link[=arx_class_args_list]{arx_class_args_list()}}.}
}
\value{
An unfit \code{epi_workflow}.
}
\description{
This function creates an unfit workflow for use with \code{\link[=arx_classifier]{arx_classifier()}}.
It is useful if you want to make small modifications to that classifier
before fitting and predicting. Supplying a trainer to the function
may alter the returned \code{epi_workflow} object but can be omitted.
}
\examples{
library(dplyr)
jhu <- covid_case_death_rates \%>\%
filter(time_value >= as.Date("2021-11-01"))
arx_class_epi_workflow(jhu, "death_rate", c("case_rate", "death_rate"))
arx_class_epi_workflow(
jhu,
"death_rate",
c("case_rate", "death_rate"),
trainer = multinom_reg(),
args_list = arx_class_args_list(
breaks = c(-.05, .1), ahead = 14,
horizon = 14, method = "linear_reg"
)
)
}
\seealso{
\code{\link[=arx_classifier]{arx_classifier()}} \code{\link[=arx_class_args_list]{arx_class_args_list()}}
}