iqnn_cv_predict: Cross Validated predictions for iqnn models

Description Usage Arguments Value See Also Examples

View source: R/IterativeQuantileNearestNeighbors.R

Description

Cross-validate an iqnn specification using k-fold scheme on given data

Usage

1
2
3
iqnn_cv_predict(data, y, mod_type = "reg", bin_cols, nbins,
  jit = rep(0, length(bin_cols)), stretch = FALSE, tol = rep(0,
  length(bin_cols)), strict = FALSE, cv_k = 10)

Arguments

data

Data frame containing the response variable and numeric input variables from the training data

y

Name of response variable column

mod_type

Depends on response variables type: "reg" creates iqnn-regression for predicting numeric values, "class" creates iqnn-classifier for predicting categorical values

bin_cols

vector of column names of variables to iteratively bin, ordered first to last

nbins

vector of number of bins per step of iterative binning, ordered first to last

jit

vector of margins for uniform jitter to each dimension to create seperability of tied obs due to finite precision

stretch

TRUE/FALSE if will bins be given tolerance buffer

tol

vector of tolerance values to stretch each dimension for future binning

strict

TRUE/FALSE: If TRUE Observations must fall within existing bins to be assigned; if FALSE the outer bins in each dimension are unbounded to allow outlying values to be assigned.

cv_k

integer specifying number of folds

Value

cross validated predicted responses for all observations in data

See Also

Other iterative quantile nearest-neighbors functions: iqnn_predict, iqnn_tune, iqnn

Examples

1
2
3
4
5
6
7
8
9
cv_preds <- iqnn_cv_predict(data=iris, y="Species",mod_type="class", 
                            bin_cols=c("Sepal.Length","Sepal.Width","Petal.Width"),
                            nbins=c(3,5,2), jit=rep(0.001,3), strict=FALSE, cv_k=10)
table(cv_preds, iris$Species)

cv_preds <- iqnn_cv_predict(data=iris, y="Petal.Length",mod_type="reg",
                            bin_cols=c("Sepal.Length","Sepal.Width","Petal.Width"),
                            nbins=c(3,5,2), jit=rep(0.001,3), strict=FALSE, cv_k=10)
table(cv_preds, iris$Species)

kmaurer/iqbin documentation built on Jan. 1, 2020, 6:48 p.m.