Learn R Programming

DSWE (version 1.8.2)

KnnPCFit: KNN : Fit

Description

The function models the powercurve using KNN, against supplied arguments

Usage

KnnPCFit(data, xCol, yCol, subsetSelection = FALSE)

Value

a list containing :

  • data - The data set provided by user

  • xCol - The column number of features provided by user or the best subset column number

  • yCol - The column number of target provided by user

  • bestK - The best k nearest neighbor calculated using the function

  • RMSE - The RMSE calculated using the function for provided data using user defined features and best obtained K

  • MAE - The MAE calculated using the function for provided data using user defined features and best obtained K

Arguments

data

a dataframe or a matrix, to be used in modelling

xCol

a vector or numeric values stating the column number of features

yCol

a numerical or a vector value stating the column number of target

subsetSelection

a boolean, default value is FALSE, if TRUE returns the best feature column number as xCol

Examples

Run this code

data = data1[c(1:100),]
xCol = 2
yCol = 7
subsetSelection = FALSE

knn_model = KnnPCFit(data, xCol, yCol, subsetSelection)

Run the code above in your browser using DataLab