SVR.jl

Support Vector Regression for Unsupervised Machine Learning
Author madsjulia
Popularity
18 Stars
Updated Last
11 Months Ago
Started In
December 2016

SVR

Support Vector Regression (SVR) analysis in Julia utilizing the libSVM library.

SVR is a module of MADS (Model Analysis & Decision Support).

Installation

import Pkg; Pkg.add("SVR")

Examples

Matching sine function:

import SVR
import Mads

X = sort(rand(40) * 5)
y = sin.(X)

Predict y based on X using RBF

Mads.plotseries([y SVR.fit(y, permutedims(X); kernel_type=SVR.RBF)], "figures/rbf.png"; title="RBF", names=["Truth", "Prediction"])

Predict y based on X using LINEAR

Mads.plotseries([y SVR.fit(y, permutedims(X); kernel_type=SVR.LINEAR)], "figures/linear.png"; title="Linear", names=["Truth", "Prediction"])

Predict y based on X using POLY

Mads.plotseries([y SVR.fit(y, permutedims(X); kernel_type=SVR.POLY, coef0=1.)], "figures/poly.png"; title="Polynomial", names=["Truth", "Prediction"])

libSVM test example:

import SVR

x, y = SVR.readlibsvmfile(joinpath(dirname(pathof(SVR)), "..", "test", "mg.libsvm")) # read a libSVM input file

pmodel = SVR.train(y, permutedims(x)) # train a libSVM model

y_pr = SVR.predict(pmodel, permutedims(x)); # predict based on the libSVM model

SVR.savemodel(pmodel, "mg.model") # save the libSVM model

SVR.freemodel(pmodel) # free the memory allocation of the libSVM model

Projects using SVR

Publications, Presentations, Projects