prediction: Functions for prediction

Description Usage Arguments Details Value Examples

Description

List of prediction functions

Usage

1
2
3
4
5
6
7
get_confusion_matrix(dta, truth, predicted)

get_important_variables(model, plot = FALSE)

plot_distribution(dta, truth = NULL, ...)

get_prediction(dta, model, predicted, score, target_name)

Arguments

dta

A dataframe that represents model prediction results, score, truth, label to be predicted

truth

A column name (in dta) that represents true labels of the predicted target

predicted

A column name (in dta) that represents predicted classes

model

A ready-built model object

...

A list of selected variables

target_name

A string that represents label name of the predicted target

rank_percentile

A list of percentile to display

Details

Value

Examples

 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
library(tidymodel)
library(dplyr)

# Show data
as_tibble(dta)

get_important_variables(model)

get_confusion_matrix(dta, TARGET1, PREDICTED)
                            
out = plot_distribution(dta,
                        "TARGET1",
                        "VAR1",
                        "VAR2",
                        "VAR3",
                        "VAR4")
                  
out = plot_distribution(dta,
                        NULL,
                        "VAR1",
                        "VAR2",
                        "VAR3",
                        "VAR4")
                  
# Train data
dta2 = select(dta, TARGET1, VAR1:VAR20)

                      

ldanai/tidymodel documentation built on Jan. 4, 2020, 6:25 a.m.