Learn R Programming

RcppShark (version 3.1.0)

SharkBSGDPredict: Budgeted SGD Predict.

Description

This will do prediction with a support vector machine trained by BSGD. See more on http://image.diku.dk/shark/sphinx_pages/build/html/rest_sources/tutorials/algorithms/kernelBudgetedSGD.html

Usage

SharkBSGDPredict(x, model, verbose = FALSE)

Arguments

x
matrix with input data
model
a model trained with BSGD Train
verbose
verbose output?

Examples

Run this code
	x = as.matrix(iris[,1:4])
	y = as.vector(as.numeric(iris[,5]))
	y = replace(y, y == 2, 0)
	y = replace(y, y == 3, 0)
	model = SharkBSGDTrain (x, y, C = 0.0001, 
	      budget = 5, gamma = 1, epochs = 1, strategy = "Merge")
	results = SharkBSGDPredict (x, model)
	cat ("BSGD training error is ", sum(abs(y - results$predictions))/length(y), "\n")

Run the code above in your browser using DataLab