KNN: This function performs imputation using the K-Nearest...

View source: R/KNN.R

KNNR Documentation

This function performs imputation using the K-Nearest Neighbors (KNN) algorithm and calculates various evaluation metrics including RMSE, MMAE, RRE, and Consistency Proportion Index (CPP) using different hierarchical clustering methods. It also records the execution time of the process.

Description

This function performs imputation using the K-Nearest Neighbors (KNN) algorithm and calculates various evaluation metrics including RMSE, MMAE, RRE, and Consistency Proportion Index (CPP) using different hierarchical clustering methods. It also records the execution time of the process.

Usage

KNN(data0, data.sample, data.copy, mr, km)

Arguments

data0

The original dataset containing the response variable and features.

data.sample

The dataset used for sampling, which may contain missing values.

data.copy

A copy of the original dataset, used for comparison or validation.

mr

Indices of the rows with missing values that need to be predicted.

km

The number of clusters for k-means clustering.

Value

A list containing:

Xnew

The imputed dataset.

RMSE

The Root Mean Squared Error.

MMAE

The Mean Absolute Error.

RRE

The Relative Eelative Error.

CPP1

The K-means clustering Consistency Proportion Index.

CPP2

The Hierarchical Clustering Complete Linkage Consistency Proportion Index.

CPP3

The Hierarchical Clustering Single Linkage Consistency Proportion Index.

CPP4

The Hierarchical Clustering Average Linkage Consistency Proportion Index.

CPP5

The Hierarchical Clustering Centroid linkage Consistency Proportion Index.

CPP6

The Hierarchical Clustering Median Linkage Consistency Proportion Index.

CPP7

The Hierarchical Clustering Ward's Method Consistency Proportion Index.

timeKNN

The KNN algorithm execution time.


DTSR documentation built on April 3, 2025, 11:35 p.m.

Related to KNN in DTSR...