Showing 1 of 9 files from the diff.
Newly tracked file
R/tree-helpers.R changed.
Other files ignored by Codecov

@@ -33,9 +33,9 @@
Loading
33 33
#'
34 34
#' Predict class probability on a data set.
35 35
#'
36 -
#' @param An object of class \code{rpart}.
37 -
#' @param A \code{data.frame} or \code{tibble}.
38 -
#' @param Response variable.
36 +
#' @param model An object of class \code{rpart}.
37 +
#' @param data A \code{data.frame} or \code{tibble}.
38 +
#' @param response Response variable.
39 39
#'
40 40
#' @examples
41 41
#' model <- rpart::rpart(Attrition ~ ., data = hr_train)
@@ -45,13 +45,13 @@
Loading
45 45
#'
46 46
#' @export
47 47
#'
48 -
tree_prediction <- function(model, test_data, response) {
48 +
tree_prediction <- function(model, data, response) {
49 49
50 50
  resp_var <- rlang::enquo(response)
51 -
  resp <- dplyr::pull(test_data, !!resp_var)
51 +
  resp <- dplyr::pull(data, !!resp_var)
52 52
53 53
  model %>%
54 -
    predict(newdata = test_data, type = "prob") %>%
54 +
    stats::predict(newdata = data, type = "prob") %>%
55 55
    as.data.frame() %>%
56 56
    dplyr::select(2) %>%
57 57
    ROCR::prediction(resp)
@@ -73,7 +73,7 @@
Loading
73 73
tree_auc <- function(perform) {
74 74
  perform %>%
75 75
    ROCR::performance(measure = "auc") %>%
76 -
    slot("y.values") %>%
76 +
    methods::slot("y.values") %>%
77 77
    magrittr::extract2(1)
78 78
}
79 79
@@ -136,22 +136,18 @@
Loading
136 136
137 137
}
138 138
139 -
#' Generic plot function
140 -
#'
141 -
#' A generic plot function used to generate validation plots.
142 -
#'
143 139
plot_perform <- function(perform, y, x, line_color = "blue") {
144 140
145 141
	measures <- ROCR::performance(perform, measure = y, x.measure = x)
146 142
147 143
  yval <-
148 144
    measures %>%
149 -
    slot("y.values") %>%
145 +
    methods::slot("y.values") %>%
150 146
    magrittr::extract2(1)
151 147
152 148
  xval <-
153 149
    measures %>%
154 -
    slot("x.values") %>%
150 +
    methods::slot("x.values") %>%
155 151
    magrittr::extract2(1)
156 152
157 153
  data.frame(yval, xval) %>%
Files Coverage
R 100.00%
Project Totals (3 files) 100.00%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
    patch:
10
      default:
11
        target: auto
12
        threshold: 1%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading