run_predict {alookr}R Documentation

Predict binary classification model

Description

Predict some representative binary classification models.

Usage

run_predict(model, .data, cutoff = 0.5)

Arguments

model

A model_df. results of fitted model that created by run_models().

.data

A tbl_df. The data set to predict the model. It also supports tbl, and data.frame objects.

cutoff

numeric. Cut-off that determines the positive from the probability of predicting the positive.

Details

Supported models are functions supported by the representative model package used in R environment. The following binary classifications are supported:

run_predict() is executed in parallel when predicting by model. However, it is not supported in MS-Windows operating system and RStudio environment.

Value

model_df. results of predicted model. model_df is composed of tbl_df and contains the following variables.:

Examples

library(dplyr)

# Divide the train data set and the test data set.
sb <- rpart::kyphosis %>%
  split_by(Kyphosis)

# Extract the train data set from original data set.
train <- sb %>%
  extract_set(set = "train")

# Extract the test data set from original data set.
test <- sb %>%
  extract_set(set = "test")

# Sampling for unbalanced data set using SMOTE(synthetic minority over-sampling technique).
train <- sb %>%
  sampling_target(seed = 1234L, method = "ubSMOTE")

# Cleaning the set.
train <- train %>%
  cleanse

# Run the model fitting.
result <- run_models(.data = train, target = "Kyphosis", positive = "present")
result

# Run the several kinds model predict by dplyr
result %>%
  run_predict(test)


[Package alookr version 0.3.9 Index]