LIBSVM.LinearSVC
— TypeLinear SVM using LIBLINEAR
LIBSVM.svmmodel
— MethodConvert SVM model to libsvm struct for prediction
LIBSVM.svmpredict
— Methodsvmpredict{T,U<:Real}(model::SVM{T}, X::AbstractMatrix{U})
Predict values using model
based on data X
. The shape of X
needs to be (nfeatures, nsamples). The method returns tuple (predictions, decisionvalues).
LIBSVM.svmtrain
— Methodsvmtrain(
X::AbstractMatrix{U}, y::AbstractVector{T} = [];
svmtype::Type = SVC,
kernel::Kernel.KERNEL = Kernel.RadialBasis,
degree::Integer = 3,
gamma::Float64 = 1.0/size(X, 1),
coef0::Float64 = 0.0,
cost::Float64=1.0,
nu::Float64 = 0.5,
epsilon::Float64 = 0.1,
tolerance::Float64 = 0.001,
shrinking::Bool = true,
probability::Bool = false,
weights::Union{Dict{T,Float64},Cvoid} = nothing,
cachesize::Float64 = 200.0,
verbose::Bool = false
) where {T,U<:Real}
Train Support Vector Machine using LIBSVM using response vector y
and training data X
. The shape of X
needs to be (nfeatures, nsamples)
. For one-class SVM use only X
.
Arguments
svmtype::Type = LIBSVM.SVC
: Type of SVM to trainSVC
(for C-SVM),NuSVC
OneClassSVM
,EpsilonSVR
orNuSVR
. Defaults toOneClassSVM
ify
is not used.kernel::Kernels.KERNEL = Kernel.RadialBasis
: Model kernelLinear
,Polynomial
,RadialBasis
,Sigmoid
orPrecomputed
.degree::Integer = 3
: Kernel degree. Used for polynomial kernelgamma::Float64 = 1.0/size(X, 1)
: γ for kernelscoef0::Float64 = 0.0
: parameter for sigmoid and polynomial kernelcost::Float64 = 1.0
: cost parameter C of C-SVC, epsilon-SVR, and nu-SVRnu::Float64 = 0.5
: parameter nu of nu-SVC, one-class SVM, and nu-SVRepsilon::Float64 = 0.1
: epsilon in loss function of epsilon-SVRtolerance::Float64 = 0.001
: tolerance of termination criterionshrinking::Bool = true
: whether to use the shrinking heuristicsprobability::Bool = false
: whether to train a SVC or SVR model for probability estimatesweights::Union{Dict{T, Float64}, Cvoid}=nothing
: dictionary of class weightscachesize::Float64 = 100.0
: cache memory size in MBverbose::Bool = false
: print training output from LIBSVM if truent::Integer = 0
: number of OpenMP cores to use, if 0 it is set to OMPNUMTHREADS, if negative it is set to the max number of threads
Consult LIBSVM documentation for advice on the choise of correct parameters and model tuning.