ChooseAlgorithm: Returns which algorithm among Multiclass SVM, KNN and...

Description Usage Arguments Value Examples

View source: R/Algorithm.R

Description

Returns which algorithm among Multiclass SVM, KNN and Multiclass logistic performs better on the labelled data set using cross validation technique

Usage

1
ChooseAlgorithm(Xtilde, Y, K = NULL)

Arguments

Xtilde

n * p centered and scaled data points

Y

A numeric n vector of labels of Xtilde

K

Number of classes, ( If K is NULL, it calculates K as maximum entry in Y)

Value

A string among c("KNN", "Logistic", "SVM") which tells us which algorithm performs better on the labelled data set

Examples

1
2
3
4
5
6
7
8
X <- rbind(matrix(rnorm(10,0,1),5,2),matrix(rnorm(10,1,2),5,2), matrix(rnorm(10,4,3),5,2))
fold_ids <- sample(1:15)
X <- X[fold_ids, ]
Xtilde <- standardizeX(X)$tilde
Y <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3)
Y <- Y[fold_ids]
out <- ChooseAlgorithm(Xtilde,Y,3)
#"KNN"

gargjhanvi/SSLLabelGuide documentation built on Dec. 20, 2021, 9:48 a.m.