read.svm.data {rpud}R Documentation

Reading SVM Training Data from a File

Description

The read.svm.data reads a training file in the LIBSVM data format, and is a replacement of the read.matrix.csr function in e1071.

In the non-free rpudplus add-on, the method redirects to a native C++ implementation with enhanced robustness and performance.

This method is not supported in the free rpud package.

Usage

read.svm.data(file, fac = TRUE, sparse = TRUE)

Arguments

file

The path name of the file in LIBSVM training data format.

fac

If TRUE and y-values are stored in the file, the values are interpreted as factor levels.

sparse

If TRUE, the x-values are loaded into a matrix.csr object provided by the SparseM package. If FALSE, the x-values are loaded into a data matrix instead.

Value

The method returns a list with two components:

x

object of class matrix.csr or a data matrix, depending on the value of sparse.

y

vector of numeric values or factor levels, depending on the value of fac.

Author(s)

Chi Yau (based on R doc of read.matrix.csr in e1071 by David Meyer)
chi.yau@r-tutor.com

See Also

matrix.csr

Examples

## Not run: 

library(rpud)
library(SparseM)

filepath <- file.path(.path.package(package="rpud"), "runit/data/heart_scale")
hs <- read.svm.data(filepath, fac=TRUE)

x <- hs$x
y <- hs$y
    
model <- rpusvm(x, y)
summary(model)


## End(Not run)

[Package rpud version 0.7.2 Index]