plot_roc: Plot ROC curves

Description Usage Arguments Value See Also Examples

View source: R/plot_roc.R

Description

This function plots ROC curves from the results of the assess_models function

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
plot_roc(
  ...,
  individual_plot = TRUE,
  combined_plot = TRUE,
  facet_plot = TRUE,
  facet_summary = TRUE,
  colors,
  model_names,
  plot_auc_polygon = TRUE,
  plot_ci = TRUE,
  line_size = 1,
  print_auc = TRUE,
  print_ci = TRUE,
  print_auc_ci_font_size = 4,
  print_auc_ci_x,
  print_auc_ci_y,
  plot_legend = TRUE,
  plot_title,
  facet_n_row = NULL,
  facet_n_col = 2,
  legend_spacing = FALSE
)

Arguments

...

Output(s) of the language_model, comparison_model, or test_language_model functions

individual_plot

If TRUE, graphs individual ROC curves for each model. Defaults to TRUE.

combined_plot

If TRUE, and modelAssessment contains multiple models, graphs a plot with all ROC curves overlapping. Defaults to TRUE.

facet_plot

If TRUE, and modelAssessment contains multiple models, graphs a faceted plot with all ROC curves included. Defaults to TRUE.

facet_summary

If TRUE, and modelAssessment contains multiple models, the facet_plot will include a plot with all ROC curves overlapping. Defaults to TRUE.

colors

A vector of colors to use for each model's ROC curve.

model_names

A vector of strings to use as titles/names for each model.

plot_auc_polygon

If TRUE, the area below with ROC curve with the lowest AUC will be shaded in. Defaults to TRUE.

plot_ci

If TRUE, a confidence band will be plotted around each ROC curve. Defaults to TRUE.

line_size

A numeric representing the width of the ROC curve line. Defaults to 1.

print_auc

If TRUE, the value of the AUC will be printed on the plot. Defaults to TRUE.

print_ci

If TRUE, the range of the confidence interval will be printed on the plot. Defaults to TRUE.

print_auc_ci_font_size

The font size for printed values for the AUC and confidence interval. Defaults to 4.

print_auc_ci_x

A vector of x (horizontal) positions determining where on the plot the AUC and confidence interval values will be printed.

print_auc_ci_y

A vector of y (vertical) positions determining where on the plot the AUC and confidence interval values will be printed.

plot_legend

If TRUE, a legend will be printed on all plots.

plot_title

The title of the plot

facet_n_row

The number of rows used to plot the facet_plot. Defaults to NULL.

facet_n_col

The number of columns used to plot the facet_plot. Defaults to 2.

legend_spacing

If TRUE, there will be spacing between the legend items. Defaults to FALSE.

Value

Nothing (this function plots a series of graphs)

See Also

language_model, comparison_model, test_language_model

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
## Not run: 
strong_movie_review_data$cleanText = clean_text(strong_movie_review_data$text)
mild_movie_review_data$cleanText = clean_text(mild_movie_review_data$text)

# Using language to predict "Positive" vs. "Negative" reviews
# Only for strong reviews (ratings of 1 or 10)
movie_model_strong = language_model(strong_movie_review_data,
                                     outcome = "valence",
                                     outcomeType = "binary",
                                     text = "cleanText",
                                     progressBar = FALSE)

# Using language to predict "Positive" vs. "Negative" reviews
# Only for mild reviews (ratings of 4 or 7)
movie_model_mild = language_model(mild_movie_review_data,
                                     outcome = "valence",
                                     outcomeType = "binary",
                                     text = "cleanText",
                                     progressBar = FALSE)


# Plot ROC curves
plot_roc(movie_model_strong, movie_model_mild)

## End(Not run)

nlanderson9/languagePredictR documentation built on June 10, 2021, 11 a.m.