File: _libsvm.pxi

package info (click to toggle)
scikit-learn 1.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,280 kB
  • sloc: python: 184,491; cpp: 5,783; ansic: 854; makefile: 307; sh: 45; javascript: 1
file content (73 lines) | stat: -rw-r--r-- 3,180 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
################################################################################
# Includes
cdef extern from "_svm_cython_blas_helpers.h":
    ctypedef double (*dot_func)(int, double*, int, double*, int)
    cdef struct BlasFunctions:
        dot_func dot


cdef extern from "svm.h":
    cdef struct svm_node
    cdef struct svm_model
    cdef struct svm_parameter:
        int svm_type
        int kernel_type
        int degree	# for poly
        double gamma	# for poly/rbf/sigmoid
        double coef0	# for poly/sigmoid

        # these are for training only
        double cache_size # in MB
        double eps	# stopping criteria
        double C	# for C_SVC, EPSILON_SVR and NU_SVR
        int nr_weight		# for C_SVC
        int *weight_label	# for C_SVC
        double* weight		# for C_SVC
        double nu	# for NU_SVC, ONE_CLASS, and NU_SVR
        double p	# for EPSILON_SVR
        int shrinking	# use the shrinking heuristics
        int probability # do probability estimates
        int max_iter  # ceiling on Solver runtime
        int random_seed  # seed for random generator in probability estimation

    cdef struct svm_problem:
        int l
        double *y
        svm_node *x
        double *W # instance weights

    char *svm_check_parameter(svm_problem *, svm_parameter *)
    svm_model *svm_train(svm_problem *, svm_parameter *, int *, BlasFunctions *) nogil
    void svm_free_and_destroy_model(svm_model** model_ptr_ptr)
    void svm_cross_validation(svm_problem *, svm_parameter *, int nr_fold, double *target, BlasFunctions *) nogil


cdef extern from "libsvm_helper.c":
    # this file contains methods for accessing libsvm 'hidden' fields
    svm_node **dense_to_sparse (char *, cnp.npy_intp *)
    void set_parameter (svm_parameter *, int , int , int , double, double ,
                                  double , double , double , double,
                                  double, int, int, int, char *, char *, int,
                                  int)
    void set_problem (svm_problem *, char *, char *, char *, cnp.npy_intp *, int)

    svm_model *set_model (svm_parameter *, int, char *, cnp.npy_intp *,
                         char *, cnp.npy_intp *, cnp.npy_intp *, char *,
                         char *, char *, char *, char *)

    void copy_sv_coef   (char *, svm_model *)
    void copy_n_iter  (char *, svm_model *)
    void copy_intercept (char *, svm_model *, cnp.npy_intp *)
    void copy_SV        (char *, svm_model *, cnp.npy_intp *)
    int copy_support (char *data, svm_model *model)
    int copy_predict (char *, svm_model *, cnp.npy_intp *, char *, BlasFunctions *) nogil
    int copy_predict_proba (char *, svm_model *, cnp.npy_intp *, char *, BlasFunctions *) nogil
    int copy_predict_values(char *, svm_model *, cnp.npy_intp *, char *, int, BlasFunctions *) nogil
    void copy_nSV     (char *, svm_model *)
    void copy_probA   (char *, svm_model *, cnp.npy_intp *)
    void copy_probB   (char *, svm_model *, cnp.npy_intp *)
    cnp.npy_intp  get_l  (svm_model *)
    cnp.npy_intp  get_nr (svm_model *)
    int  free_problem   (svm_problem *)
    int  free_model     (svm_model *)
    void set_verbosity(int)