Trains the Kernel Discriminant Learning for Ordinal Regression model with training data

kdlortrain(traindata, trainlabels, kernel, d, u, k)

Arguments

traindata

Data to train kdlor model. Tags should not be provided in traindata.

trainlabels

Class labels for training data. Must be numeric of type integer.

kernel

Type of kernel to compute the Gram matrix. One of "rbf","gauss","gaussian","sigmoid","linear","poly","polynomial".

d

Numeric parameter for optimization method. Default is 10.

u

Numeric parameter for H matrix computation. Default is 0.01.

k

Array of kernel Params. If kernel type is sigmoid, Array of two values should be provided.

Value

An instance of kdlorModel class containing the fields: projectedTrain, predictedTrain, kerneltype, kernelParam, projection and thresholds

where:

projectedTrain is the projected matrix for training data.

predictedTrain are the predicted numeric labels for training data.

kerneltype is the used kernel type for the fit. Should be used again for prediction.

kernelParam is the numeric kernel param used for computing the kernel matrix.

projection is the general projected matrix that should be used in predict.

thresholds is an array of doubles representing the model thresholds to be used in prediction.

Each of these fields can be accesed with "@" (see section examples) below.

Examples

# read train data dattrain<-read.table("train_balance-scale.0", sep=" ")
#> Warning: cannot open file 'train_balance-scale.0': No such file or directory
#> Error in file(file, "rt"): cannot open the connection
traindata=dattrain[,-ncol(dattrain)]
#> Error in eval(expr, envir, enclos): object 'dattrain' not found
trainlabels=dattrain[,ncol(dattrain)]
#> Error in eval(expr, envir, enclos): object 'dattrain' not found
# fit the kdlor model myfit<-kdlortrain(traindata,trainlabels,"rbf",10,0.001,1)
#> Error in kdlortrain(traindata, trainlabels, "rbf", 10, 0.001, 1): object 'trainlabels' not found
# acess kdlor model fields myfit@predictedTrain
#> Error in eval(expr, envir, enclos): object 'myfit' not found