W3cubDocs

/Nim

Module libsvm

This module is a low level wrapper for libsvm.

Types

Node = object
  index*: cint
  value*: cdouble
Problem = object
  L*: cint
  y*: ptr cdouble
  x*: ptr ptr Node
Type = enum
  C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR
KernelType = enum
  LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED
Parameter = object
  typ*: Type
  kernelType*: KernelType
  degree*: cint
  gamma*: cdouble
  coef0*: cdouble
  cache_size*: cdouble
  eps*: cdouble
  C*: cdouble
  nr_weight*: cint
  weight_label*: ptr cint
  weight*: ptr cdouble
  nu*: cdouble
  p*: cdouble
  shrinking*: cint
  probability*: cint
Model = object
  param*: Parameter
  nr_class*: cint
  L*: cint
  SV*: ptr ptr Node
  sv_coef*: ptr ptr cdouble
  rho*: ptr cdouble
  probA*: ptr cdouble
  probB*: ptr cdouble
  label*: ptr cint
  nSV*: ptr cint
  free_sv*: cint

Consts

LIBSVM_VERSION = 312
svmdll = "libsvm.dll"

Procs

proc train(prob: ptr Problem; param: ptr Parameter): ptr Model {.cdecl,
    importc: "svm_train", dynlib: svmdll.}
proc cross_validation(prob: ptr Problem; param: ptr Parameter; nr_fold: cint;
                     target: ptr cdouble) {.cdecl, importc: "svm_cross_validation",
    dynlib: svmdll.}
proc save_model(model_file_name: cstring; model: ptr Model): cint {.cdecl,
    importc: "svm_save_model", dynlib: svmdll.}
proc load_model(model_file_name: cstring): ptr Model {.cdecl,
    importc: "svm_load_model", dynlib: svmdll.}
proc get_svm_type(model: ptr Model): cint {.cdecl, importc: "svm_get_svm_type",
                                       dynlib: svmdll.}
proc get_nr_class(model: ptr Model): cint {.cdecl, importc: "svm_get_nr_class",
                                       dynlib: svmdll.}
proc get_labels(model: ptr Model; label: ptr cint) {.cdecl, importc: "svm_get_labels",
    dynlib: svmdll.}
proc get_svr_probability(model: ptr Model): cdouble {.cdecl,
    importc: "svm_get_svr_probability", dynlib: svmdll.}
proc predict_values(model: ptr Model; x: ptr Node; dec_values: ptr cdouble): cdouble {.
    cdecl, importc: "svm_predict_values", dynlib: svmdll.}
proc predict(model: ptr Model; x: ptr Node): cdouble {.cdecl, importc: "svm_predict",
    dynlib: svmdll.}
proc predict_probability(model: ptr Model; x: ptr Node; prob_estimates: ptr cdouble): cdouble {.
    cdecl, importc: "svm_predict_probability", dynlib: svmdll.}
proc free_model_content(model_ptr: ptr Model) {.cdecl,
    importc: "svm_free_model_content", dynlib: svmdll.}
proc free_and_destroy_model(model_ptr_ptr: ptr ptr Model) {.cdecl,
    importc: "svm_free_and_destroy_model", dynlib: svmdll.}
proc destroy_param(param: ptr Parameter) {.cdecl, importc: "svm_destroy_param",
                                       dynlib: svmdll.}
proc check_parameter(prob: ptr Problem; param: ptr Parameter): cstring {.cdecl,
    importc: "svm_check_parameter", dynlib: svmdll.}
proc check_probability_model(model: ptr Model): cint {.cdecl,
    importc: "svm_check_probability_model", dynlib: svmdll.}
proc set_print_string_function(print_func: proc (arg: cstring) {.cdecl.}) {.cdecl,
    importc: "svm_set_print_string_function", dynlib: svmdll.}

© 2006–2017 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/libsvm.html