Skip to content

SVR.jl

Module SVR provides Support Vector Regression (SVR) using libSVM library.

SVR.jl module functions:

# SVR.apredictMethod.

Predict based on a libSVM model

Methods:

  • SVR.apredict(y::AbstractVector{Float64}, x::AbstractArray{Float64, N} where N; kw...) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRfunctions.jl:283

Arguments:

  • x::AbstractArray{Float64, N} where N : array of independent variables
  • y::AbstractVector{Float64} : vector of dependent variables

Return:

  • predicted dependent variables

source

# SVR.freemodelMethod.

Free a libSVM model

Methods:

  • SVR.freemodel(pmodel::SVR.svmmodel) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRfunctions.jl:351

Arguments:

  • pmodel::SVR.svmmodel : svm model

source

# SVR.get_prediction_maskMethod.

Get prediction mask

Methods:

  • SVR.get_prediction_mask(ns::Number, ratio::Number; keepcases) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRfunctions.jl:247

Arguments:

  • ns::Number : number of samples
  • ratio::Number : prediction ratio

Keywords:

  • keepcases

Return:

  • prediction mask

source

# SVR.loadmodelMethod.

Load a libSVM model

Methods:

  • SVR.loadmodel(filename::AbstractString) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRfunctions.jl:314

Arguments:

  • filename::AbstractString : input file name

Returns:

  • SVM model

source

# SVR.mapnodesMethod.

Methods:

  • SVR.mapnodes(x::AbstractArray) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRlib.jl:63

Arguments:

  • x::AbstractArray :

source

# SVR.mapparamMethod.

Methods:

  • SVR.mapparam(; svm_type, kernel_type, degree, gamma, coef0, C, nu, epsilon, cache_size, tolerance, shrinking, probability, nr_weight, weight_label, weight) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRlib.jl:23

Keywords:

  • C : cost; penalty parameter of the error term [default=1.0]
  • cache_size : size of the kernel cache [default=100.0]
  • coef0 : independent term in kernel function; important only in POLY and SIGMOND kernel types [default=0.0]
  • degree : degree of the polynomial kernel [default=3]
  • epsilon : epsilon for EPSILON_SVR model; defines an epsilon-tube within which no penalty is associated in the training loss function with points predicted within a distance epsilon from the actual value [default=1e-9]
  • gamma : coefficient for RBF, POLY and SIGMOND kernel types [default=1.0]
  • kernel_type : kernel type [default=RBF]
  • nr_weight : [default=0]
  • nu : upper bound on the fraction of training errors / lower bound of the fraction of support vectors; acceptable range (0, 1]; applied if NU_SVR model [default=0.5]
  • probability : train to estimate probabilities [default=false]
  • shrinking : apply shrinking heuristic [default=true]
  • svm_type : SVM type [default=EPSILON_SVR]
  • tolerance : tolerance; stopping criteria[default=0.001]
  • weight : [default=Ptr{Cdouble}(0x0000000000000000)]
  • weight_label : [default=Ptr{Cint}(0x0000000000000000)]

Returns:

  • parameter

source

# SVR.predictMethod.

Predict based on a libSVM model

Methods:

  • SVR.predict(pmodel::SVR.svmmodel, x::AbstractArray{Float64, N} where N) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRfunctions.jl:69

Arguments:

  • pmodel::SVR.svmmodel : the model that prediction is based on
  • x::AbstractArray{Float64, N} where N : array of independent variables

Return:

  • predicted dependent variables

source

# SVR.r2Method.

Compute the coefficient of determination (r2)

Methods:

  • SVR.r2(x::AbstractVector{T} where T, y::AbstractVector{T} where T) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRfunctions.jl:396

Arguments:

  • x::AbstractVector{T} where T : observed data
  • y::AbstractVector{T} where T : predicted data

Returns:

  • coefficient of determination (r2)

source

# SVR.readlibsvmfileMethod.

Read a libSVM file

Methods:

  • SVR.readlibsvmfile(file::AbstractString) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRfunctions.jl:370

Arguments:

  • file::AbstractString : file name

Returns:

  • array of independent variables
  • vector of dependent variables

source

# SVR.savemodelMethod.

Save a libSVM model

Methods:

  • SVR.savemodel(pmodel::SVR.svmmodel, filename::AbstractString) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRfunctions.jl:336

Arguments:

  • filename::AbstractString : output file name
  • pmodel::SVR.svmmodel : svm model

Dumps:

  • file with saved model

source

# SVR.testMethod.

Test SVR

source

# SVR.trainMethod.

Train based on a libSVM model

Methods:

  • SVR.train(y::AbstractVector{Float64}, x::AbstractArray{Float64, N} where N; svm_type, kernel_type, degree, gamma, coef0, C, nu, epsilon, cache_size, tol, shrinking, probability, verbose) in SVR : /Users/vvv/.julia/dev/SVR/src/SVRfunctions.jl:32

Arguments:

  • x::AbstractArray{Float64, N} where N : array of independent variables
  • y::AbstractVector{Float64} : vector of dependent variables

Keywords:

  • C : cost; penalty parameter of the error term [default=1.0]
  • cache_size : size of the kernel cache [default=100.0]
  • coef0 : independent term in kernel function; important only in POLY and SIGMOND kernel types [default=0.0]
  • degree : degree of the polynomial kernel [default=3]
  • epsilon : epsilon in the EPSILON_SVR model; defines an epsilon-tube within which no penalty is associated in the training loss function with points predicted within a distance epsilon from the actual value [default=1e-9]
  • gamma : coefficient for RBF, POLY and SIGMOND kernel types [default=1/size(x, 1)]
  • kernel_type : kernel type [default=RBF]
  • nu : upper bound on the fraction of training errors / lower bound of the fraction of support vectors; acceptable range (0, 1]; applied if NU_SVR model [default=0.5]
  • probability : train to estimate probabilities [default=false]
  • shrinking : apply shrinking heuristic [default=true]
  • svm_type : SVM type [default=EPSILON_SVR]
  • tol : tolerance of termination criterion [default=0.001]
  • verbose : verbose output [default=false]

Returns:

  • SVM model

source