Description Usage Arguments Value See Also Examples
View source: R/IterativeQuantileNearestNeighbors.R
Identify optimal number of bins per dimension for iterative quantile nearest-neighbor model using k-fold cross validation.
Search through possible numbers of bins per dimension using a iterative rules defined in the make_nbins_list
function.
1 2 3 4 |
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_range |
positive integer vector containing lower and upper bounds on number of bins in each dimension |
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 |
oom_search |
TRUE/FALSE: Only consider nbins that change number of neighbors by order of magnitudes |
oom_base |
order of magnitude base value (default to powers of 2) |
data frame with one row per binning specification with desriptive and performance statistics: bin dimensitions, number of bins, equivalent k-nearest neightbor size, performance (mean squared error or class error rate)
Other iterative quantile nearest-neighbors functions: iqnn_cv_predict
,
iqnn_predict
, iqnn
1 2 3 4 5 6 7 8 9 10 | # 10-fold CV
cv_tune1 <- iqnn_tune(data=iris, y="Petal.Length", mod_type="reg",
bin_cols=c("Sepal.Length","Sepal.Width","Petal.Width"),
nbins_range=c(2,5), jit=rep(0.001,3), strict=FALSE, cv_k=10)
cv_tune1
# LOO CV
cv_tune2 <- iqnn_tune(data=iris, y="Petal.Length", mod_type="reg",
bin_cols=c("Sepal.Length","Sepal.Width","Petal.Width"),
nbins_range=c(2,5), jit=rep(0.001,3), strict=FALSE, cv_k=nrow(iris))
cv_tune2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.