Definition at line 232 of file SVMLight.h.

Public Member Functions | |
| CSVMLight () | |
| CSVMLight (float64_t C, CKernel *k, CLabels *lab) | |
| virtual | ~CSVMLight () |
| void | init () |
| virtual bool | train (CFeatures *data=NULL) |
| virtual EClassifierType | get_classifier_type () |
| int32_t | get_runtime () |
| void | svm_learn () |
| int32_t | optimize_to_convergence (int32_t *docs, int32_t *label, int32_t totdoc, SHRINK_STATE *shrink_state, int32_t *inconsistent, float64_t *a, float64_t *lin, float64_t *c, TIMING *timing_profile, float64_t *maxdiff, int32_t heldout, int32_t retrain) |
| virtual float64_t | compute_objective_function (float64_t *a, float64_t *lin, float64_t *c, float64_t *eps, int32_t *label, int32_t totdoc) |
| void | clear_index (int32_t *index) |
| void | add_to_index (int32_t *index, int32_t elem) |
| int32_t | compute_index (int32_t *binfeature, int32_t range, int32_t *index) |
| void | optimize_svm (int32_t *docs, int32_t *label, int32_t *exclude_from_eq_const, float64_t eq_target, int32_t *chosen, int32_t *active2dnum, int32_t totdoc, int32_t *working2dnum, int32_t varnum, float64_t *a, float64_t *lin, float64_t *c, float64_t *aicache, QP *qp, float64_t *epsilon_crit_target) |
| void | compute_matrices_for_optimization (int32_t *docs, int32_t *label, int32_t *exclude_from_eq_const, float64_t eq_target, int32_t *chosen, int32_t *active2dnum, int32_t *key, float64_t *a, float64_t *lin, float64_t *c, int32_t varnum, int32_t totdoc, float64_t *aicache, QP *qp) |
| void | compute_matrices_for_optimization_parallel (int32_t *docs, int32_t *label, int32_t *exclude_from_eq_const, float64_t eq_target, int32_t *chosen, int32_t *active2dnum, int32_t *key, float64_t *a, float64_t *lin, float64_t *c, int32_t varnum, int32_t totdoc, float64_t *aicache, QP *qp) |
| int32_t | calculate_svm_model (int32_t *docs, int32_t *label, float64_t *lin, float64_t *a, float64_t *a_old, float64_t *c, int32_t *working2dnum, int32_t *active2dnum) |
| int32_t | check_optimality (int32_t *label, float64_t *a, float64_t *lin, float64_t *c, int32_t totdoc, float64_t *maxdiff, float64_t epsilon_crit_org, int32_t *misclassified, int32_t *inconsistent, int32_t *active2dnum, int32_t *last_suboptimal_at, int32_t iteration) |
| virtual void | update_linear_component (int32_t *docs, int32_t *label, int32_t *active2dnum, float64_t *a, float64_t *a_old, int32_t *working2dnum, int32_t totdoc, float64_t *lin, float64_t *aicache, float64_t *c) |
| void | update_linear_component_mkl (int32_t *docs, int32_t *label, int32_t *active2dnum, float64_t *a, float64_t *a_old, int32_t *working2dnum, int32_t totdoc, float64_t *lin, float64_t *aicache) |
| void | update_linear_component_mkl_linadd (int32_t *docs, int32_t *label, int32_t *active2dnum, float64_t *a, float64_t *a_old, int32_t *working2dnum, int32_t totdoc, float64_t *lin, float64_t *aicache) |
| void | call_mkl_callback (float64_t *a, int32_t *label, float64_t *lin) |
| int32_t | select_next_qp_subproblem_grad (int32_t *label, float64_t *a, float64_t *lin, float64_t *c, int32_t totdoc, int32_t qp_size, int32_t *inconsistent, int32_t *active2dnum, int32_t *working2dnum, float64_t *selcrit, int32_t *select, int32_t cache_only, int32_t *key, int32_t *chosen) |
| int32_t | select_next_qp_subproblem_rand (int32_t *label, float64_t *a, float64_t *lin, float64_t *c, int32_t totdoc, int32_t qp_size, int32_t *inconsistent, int32_t *active2dnum, int32_t *working2dnum, float64_t *selcrit, int32_t *select, int32_t *key, int32_t *chosen, int32_t iteration) |
| void | select_top_n (float64_t *selcrit, int32_t range, int32_t *select, int32_t n) |
| void | init_shrink_state (SHRINK_STATE *shrink_state, int32_t totdoc, int32_t maxhistory) |
| void | shrink_state_cleanup (SHRINK_STATE *shrink_state) |
| int32_t | shrink_problem (SHRINK_STATE *shrink_state, int32_t *active2dnum, int32_t *last_suboptimal_at, int32_t iteration, int32_t totdoc, int32_t minshrink, float64_t *a, int32_t *inconsistent, float64_t *c, float64_t *lin, int *label) |
| virtual void | reactivate_inactive_examples (int32_t *label, float64_t *a, SHRINK_STATE *shrink_state, float64_t *lin, float64_t *c, int32_t totdoc, int32_t iteration, int32_t *inconsistent, int32_t *docs, float64_t *aicache, float64_t *maxdiff) |
Static Public Member Functions | |
| static void * | update_linear_component_mkl_linadd_helper (void *p) |
Protected Member Functions | |
| virtual float64_t | compute_kernel (int32_t i, int32_t j) |
| virtual const char * | get_name () const |
| float64_t * | optimize_qp (QP *qp, float64_t *epsilon_crit, int32_t nx, float64_t *threshold, int32_t &svm_maxqpsize) |
Static Protected Member Functions | |
| static void * | compute_kernel_helper (void *p) |
| static void * | update_linear_component_linadd_helper (void *p) |
| static void * | reactivate_inactive_examples_vanilla_helper (void *p) |
| static void * | reactivate_inactive_examples_linadd_helper (void *p) |
Protected Attributes | |
| MODEL * | model |
| LEARN_PARM * | learn_parm |
| int32_t | verbosity |
| float64_t | init_margin |
| int32_t | init_iter |
| int32_t | precision_violations |
| float64_t | model_b |
| float64_t | opt_precision |
| float64_t * | primal |
| float64_t * | dual |
| float64_t * | W |
| int32_t | count |
| float64_t | mymaxdiff |
| bool | use_kernel_cache |
| bool | mkl_converged |
| CSVMLight | ( | ) |
default constructor
Definition at line 120 of file SVMLight.cpp.
constructor
| C | constant C | |
| k | kernel | |
| lab | labels |
Definition at line 127 of file SVMLight.cpp.
| ~CSVMLight | ( | ) | [virtual] |
Definition at line 158 of file SVMLight.cpp.
| void add_to_index | ( | int32_t * | index, | |
| int32_t | elem | |||
| ) |
add to index
| index | index | |
| elem | element at index |
Definition at line 975 of file SVMLight.cpp.
| int32_t calculate_svm_model | ( | int32_t * | docs, | |
| int32_t * | label, | |||
| float64_t * | lin, | |||
| float64_t * | a, | |||
| float64_t * | a_old, | |||
| float64_t * | c, | |||
| int32_t * | working2dnum, | |||
| int32_t * | active2dnum | |||
| ) |
calculate SVM model
| docs | docs | |
| label | label | |
| lin | lin | |
| a | a | |
| a_old | old a | |
| c | c | |
| working2dnum | working 2D num | |
| active2dnum | active 2D num |
Definition at line 1246 of file SVMLight.cpp.
Definition at line 1685 of file SVMLight.cpp.
| int32_t check_optimality | ( | int32_t * | label, | |
| float64_t * | a, | |||
| float64_t * | lin, | |||
| float64_t * | c, | |||
| int32_t | totdoc, | |||
| float64_t * | maxdiff, | |||
| float64_t | epsilon_crit_org, | |||
| int32_t * | misclassified, | |||
| int32_t * | inconsistent, | |||
| int32_t * | active2dnum, | |||
| int32_t * | last_suboptimal_at, | |||
| int32_t | iteration | |||
| ) |
check optimality
| label | label | |
| a | a | |
| lin | lin | |
| c | c | |
| totdoc | totdoc | |
| maxdiff | maximum diff | |
| epsilon_crit_org | epsilon crit org | |
| misclassified | misclassified | |
| inconsistent | inconsistent | |
| active2dnum | active 2D num | |
| last_suboptimal_at | last suboptimal at | |
| iteration | iteration |
Definition at line 1363 of file SVMLight.cpp.
| void clear_index | ( | int32_t * | index | ) |
| int32_t compute_index | ( | int32_t * | binfeature, | |
| int32_t | range, | |||
| int32_t * | index | |||
| ) |
compute index
| binfeature | binary feature | |
| range | range | |
| index |
Definition at line 984 of file SVMLight.cpp.
| virtual float64_t compute_kernel | ( | int32_t | i, | |
| int32_t | j | |||
| ) | [protected, virtual] |
compute kernel
| i | at index i | |
| j | at index j |
Reimplemented in CSVRLight.
Definition at line 622 of file SVMLight.h.
| void * compute_kernel_helper | ( | void * | p | ) | [static, protected] |
| void compute_matrices_for_optimization | ( | int32_t * | docs, | |
| int32_t * | label, | |||
| int32_t * | exclude_from_eq_const, | |||
| float64_t | eq_target, | |||
| int32_t * | chosen, | |||
| int32_t * | active2dnum, | |||
| int32_t * | key, | |||
| float64_t * | a, | |||
| float64_t * | lin, | |||
| float64_t * | c, | |||
| int32_t | varnum, | |||
| int32_t | totdoc, | |||
| float64_t * | aicache, | |||
| QP * | qp | |||
| ) |
compute matrices for optimization
| docs | docs | |
| label | label | |
| exclude_from_eq_const | exclude from eq const | |
| eq_target | eq target | |
| chosen | chosen | |
| active2dnum | active 2D num | |
| key | key | |
| a | a | |
| lin | lin | |
| c | c | |
| varnum | var num | |
| totdoc | totdoc | |
| aicache | ai cache | |
| qp | QP |
Definition at line 1173 of file SVMLight.cpp.
| void compute_matrices_for_optimization_parallel | ( | int32_t * | docs, | |
| int32_t * | label, | |||
| int32_t * | exclude_from_eq_const, | |||
| float64_t | eq_target, | |||
| int32_t * | chosen, | |||
| int32_t * | active2dnum, | |||
| int32_t * | key, | |||
| float64_t * | a, | |||
| float64_t * | lin, | |||
| float64_t * | c, | |||
| int32_t | varnum, | |||
| int32_t | totdoc, | |||
| float64_t * | aicache, | |||
| QP * | qp | |||
| ) |
compute matrices for optimization in parallel
| docs | docs | |
| label | label | |
| exclude_from_eq_const | exclude from eq const | |
| eq_target | eq target | |
| chosen | chosen | |
| active2dnum | active 2D num | |
| key | key | |
| a | a | |
| lin | lin | |
| c | c | |
| varnum | var num | |
| totdoc | totdoc | |
| aicache | ai cache | |
| qp | QP |
Definition at line 1041 of file SVMLight.cpp.
| float64_t compute_objective_function | ( | float64_t * | a, | |
| float64_t * | lin, | |||
| float64_t * | c, | |||
| float64_t * | eps, | |||
| int32_t * | label, | |||
| int32_t | totdoc | |||
| ) | [virtual] |
compute objective function
| a | a | |
| lin | lin | |
| c | c | |
| eps | epsilon | |
| label | label | |
| totdoc | totdoc |
Reimplemented in CSVRLight.
Definition at line 953 of file SVMLight.cpp.
| virtual EClassifierType get_classifier_type | ( | ) | [virtual] |
get classifier type
Reimplemented from CClassifier.
Reimplemented in CDomainAdaptationSVM, CSVMLightOneClass, and CSVRLight.
Definition at line 264 of file SVMLight.h.
| virtual const char* get_name | ( | void | ) | const [protected, virtual] |
Reimplemented from CSVM.
Reimplemented in CDomainAdaptationSVM, and CSVRLight.
Definition at line 652 of file SVMLight.h.
| int32_t get_runtime | ( | ) |
| void init | ( | void | ) |
| void init_shrink_state | ( | SHRINK_STATE * | shrink_state, | |
| int32_t | totdoc, | |||
| int32_t | maxhistory | |||
| ) |
init shrink state
| shrink_state | shrink state | |
| totdoc | totdoc | |
| maxhistory | maximum history |
Definition at line 1945 of file SVMLight.cpp.
| float64_t * optimize_qp | ( | QP * | qp, | |
| float64_t * | epsilon_crit, | |||
| int32_t | nx, | |||
| float64_t * | threshold, | |||
| int32_t & | svm_maxqpsize | |||
| ) | [protected] |
Definition at line 2396 of file SVMLight.cpp.
| void optimize_svm | ( | int32_t * | docs, | |
| int32_t * | label, | |||
| int32_t * | exclude_from_eq_const, | |||
| float64_t | eq_target, | |||
| int32_t * | chosen, | |||
| int32_t * | active2dnum, | |||
| int32_t | totdoc, | |||
| int32_t * | working2dnum, | |||
| int32_t | varnum, | |||
| float64_t * | a, | |||
| float64_t * | lin, | |||
| float64_t * | c, | |||
| float64_t * | aicache, | |||
| QP * | qp, | |||
| float64_t * | epsilon_crit_target | |||
| ) |
optimise SVM
| docs | docs | |
| label | label | |
| exclude_from_eq_const | exclude from eq const | |
| eq_target | eq target | |
| chosen | chosen | |
| active2dnum | active 2D num | |
| totdoc | totdoc | |
| working2dnum | working 2D num | |
| varnum | var num | |
| a | a | |
| lin | lin | |
| c | c | |
| aicache | ai cache | |
| qp | QP | |
| epsilon_crit_target | epsilon crit target |
Definition at line 1004 of file SVMLight.cpp.
| int32_t optimize_to_convergence | ( | int32_t * | docs, | |
| int32_t * | label, | |||
| int32_t | totdoc, | |||
| SHRINK_STATE * | shrink_state, | |||
| int32_t * | inconsistent, | |||
| float64_t * | a, | |||
| float64_t * | lin, | |||
| float64_t * | c, | |||
| TIMING * | timing_profile, | |||
| float64_t * | maxdiff, | |||
| int32_t | heldout, | |||
| int32_t | retrain | |||
| ) |
optimize to convergence
| docs | the docs | |
| label | the label | |
| totdoc | the totdoc | |
| shrink_state | shrink state | |
| inconsistent | inconsistent | |
| a | a | |
| lin | lin | |
| c | c | |
| timing_profile | timing profile | |
| maxdiff | maximum diff | |
| heldout | held out | |
| retrain | retrain |
Definition at line 543 of file SVMLight.cpp.
| void reactivate_inactive_examples | ( | int32_t * | label, | |
| float64_t * | a, | |||
| SHRINK_STATE * | shrink_state, | |||
| float64_t * | lin, | |||
| float64_t * | c, | |||
| int32_t | totdoc, | |||
| int32_t | iteration, | |||
| int32_t * | inconsistent, | |||
| int32_t * | docs, | |||
| float64_t * | aicache, | |||
| float64_t * | maxdiff | |||
| ) | [virtual] |
reactivate inactive examples
| label | label | |
| a | a | |
| shrink_state | shrink state | |
| lin | lin | |
| c | c | |
| totdoc | totdoc | |
| iteration | iteration | |
| inconsistent | inconsistent | |
| docs | docs | |
| aicache | ai cache | |
| maxdiff | maximum diff |
Reimplemented in CSVRLight.
Definition at line 2098 of file SVMLight.cpp.
| void * reactivate_inactive_examples_linadd_helper | ( | void * | p | ) | [static, protected] |
helper for reactivate inactive examples linadd
| p | p |
Definition at line 2038 of file SVMLight.cpp.
| void * reactivate_inactive_examples_vanilla_helper | ( | void * | p | ) | [static, protected] |
helper for reactivate inactive examples vanilla
| p | p |
Definition at line 2061 of file SVMLight.cpp.
| int32_t select_next_qp_subproblem_grad | ( | int32_t * | label, | |
| float64_t * | a, | |||
| float64_t * | lin, | |||
| float64_t * | c, | |||
| int32_t | totdoc, | |||
| int32_t | qp_size, | |||
| int32_t * | inconsistent, | |||
| int32_t * | active2dnum, | |||
| int32_t * | working2dnum, | |||
| float64_t * | selcrit, | |||
| int32_t * | select, | |||
| int32_t | cache_only, | |||
| int32_t * | key, | |||
| int32_t * | chosen | |||
| ) |
select next qp subproblem grad
| label | label | |
| a | a | |
| lin | lin | |
| c | c | |
| totdoc | totdoc | |
| qp_size | size of qp | |
| inconsistent | inconsistent | |
| active2dnum | active 2D num | |
| working2dnum | working 2D num | |
| selcrit | selcrit | |
| select | select | |
| cache_only | cache only | |
| key | key | |
| chosen | chosen |
Definition at line 1747 of file SVMLight.cpp.
| int32_t select_next_qp_subproblem_rand | ( | int32_t * | label, | |
| float64_t * | a, | |||
| float64_t * | lin, | |||
| float64_t * | c, | |||
| int32_t | totdoc, | |||
| int32_t | qp_size, | |||
| int32_t * | inconsistent, | |||
| int32_t * | active2dnum, | |||
| int32_t * | working2dnum, | |||
| float64_t * | selcrit, | |||
| int32_t * | select, | |||
| int32_t * | key, | |||
| int32_t * | chosen, | |||
| int32_t | iteration | |||
| ) |
select next qp subproblem rand
| label | label | |
| a | a | |
| lin | lin | |
| c | c | |
| totdoc | totdoc | |
| qp_size | size of qp | |
| inconsistent | inconsistent | |
| active2dnum | active 2D num | |
| working2dnum | working 2D num | |
| selcrit | selcrit | |
| select | select | |
| key | key | |
| chosen | chosen | |
| iteration | iteration |
Definition at line 1839 of file SVMLight.cpp.
| void select_top_n | ( | float64_t * | selcrit, | |
| int32_t | range, | |||
| int32_t * | select, | |||
| int32_t | n | |||
| ) |
select top n
| selcrit | selcrit | |
| range | range | |
| select | select | |
| n | n |
Definition at line 1909 of file SVMLight.cpp.
| int32_t shrink_problem | ( | SHRINK_STATE * | shrink_state, | |
| int32_t * | active2dnum, | |||
| int32_t * | last_suboptimal_at, | |||
| int32_t | iteration, | |||
| int32_t | totdoc, | |||
| int32_t | minshrink, | |||
| float64_t * | a, | |||
| int32_t * | inconsistent, | |||
| float64_t * | c, | |||
| float64_t * | lin, | |||
| int * | label | |||
| ) |
shrink problem
| shrink_state | shrink state | |
| active2dnum | active 2D num | |
| last_suboptimal_at | last suboptimal at | |
| iteration | iteration | |
| totdoc | totdoc | |
| minshrink | minimal shrink | |
| a | a | |
| inconsistent | inconsistent | |
| c | c | |
| lin | lin | |
| label | label |
Definition at line 1977 of file SVMLight.cpp.
| void shrink_state_cleanup | ( | SHRINK_STATE * | shrink_state | ) |
cleanup shrink state
| shrink_state | shrink state |
Definition at line 1966 of file SVMLight.cpp.
| void svm_learn | ( | ) |
learn SVM
Definition at line 292 of file SVMLight.cpp.
| bool train | ( | CFeatures * | data = NULL |
) | [virtual] |
train SVM classifier
| data | training data (parameter can be avoided if distance or kernel-based classifiers are used and distance/kernels are initialized with train data) |
Reimplemented from CClassifier.
Reimplemented in CDomainAdaptationSVM, CSVMLightOneClass, and CSVRLight.
Definition at line 175 of file SVMLight.cpp.
| void update_linear_component | ( | int32_t * | docs, | |
| int32_t * | label, | |||
| int32_t * | active2dnum, | |||
| float64_t * | a, | |||
| float64_t * | a_old, | |||
| int32_t * | working2dnum, | |||
| int32_t | totdoc, | |||
| float64_t * | lin, | |||
| float64_t * | aicache, | |||
| float64_t * | c | |||
| ) | [virtual] |
update linear component
| docs | docs | |
| label | label | |
| active2dnum | active 2D num | |
| a | a | |
| a_old | old a | |
| working2dnum | working 2D num | |
| totdoc | totdoc | |
| lin | lin | |
| aicache | ai cache | |
| c | c |
Reimplemented in CSVRLight.
Definition at line 1424 of file SVMLight.cpp.
| void * update_linear_component_linadd_helper | ( | void * | p | ) | [static, protected] |
helper for update linear component linadd
| p | p |
Reimplemented in CSVRLight.
Definition at line 97 of file SVMLight.cpp.
| void update_linear_component_mkl | ( | int32_t * | docs, | |
| int32_t * | label, | |||
| int32_t * | active2dnum, | |||
| float64_t * | a, | |||
| float64_t * | a_old, | |||
| int32_t * | working2dnum, | |||
| int32_t | totdoc, | |||
| float64_t * | lin, | |||
| float64_t * | aicache | |||
| ) |
update linear component MKL
| docs | docs | |
| label | label | |
| active2dnum | active 2D num | |
| a | a | |
| a_old | old a | |
| working2dnum | working 2D num | |
| totdoc | totdoc | |
| lin | lin | |
| aicache | ai cache |
Definition at line 1521 of file SVMLight.cpp.
| void update_linear_component_mkl_linadd | ( | int32_t * | docs, | |
| int32_t * | label, | |||
| int32_t * | active2dnum, | |||
| float64_t * | a, | |||
| float64_t * | a_old, | |||
| int32_t * | working2dnum, | |||
| int32_t | totdoc, | |||
| float64_t * | lin, | |||
| float64_t * | aicache | |||
| ) |
update linear component MKL
| docs | docs | |
| label | label | |
| active2dnum | active 2D num | |
| a | a | |
| a_old | old a | |
| working2dnum | working 2D num | |
| totdoc | totdoc | |
| lin | lin | |
| aicache | ai cache |
Definition at line 1595 of file SVMLight.cpp.
| void * update_linear_component_mkl_linadd_helper | ( | void * | p | ) | [static] |
helper for update linear component MKL linadd
| p | p |
Definition at line 1672 of file SVMLight.cpp.
int32_t count [protected] |
number of iteration
Definition at line 688 of file SVMLight.h.
dual
Definition at line 679 of file SVMLight.h.
int32_t init_iter [protected] |
init iter
Definition at line 669 of file SVMLight.h.
float64_t init_margin [protected] |
init margin
Definition at line 667 of file SVMLight.h.
LEARN_PARM* learn_parm [protected] |
learn parameters
Definition at line 662 of file SVMLight.h.
bool mkl_converged [protected] |
mkl converged
Definition at line 694 of file SVMLight.h.
MODEL* model [protected] |
model
Definition at line 660 of file SVMLight.h.
model b
Definition at line 673 of file SVMLight.h.
current alpha gap
Definition at line 690 of file SVMLight.h.
float64_t opt_precision [protected] |
opt precision
Definition at line 675 of file SVMLight.h.
int32_t precision_violations [protected] |
precision violations
Definition at line 671 of file SVMLight.h.
primal
Definition at line 677 of file SVMLight.h.
bool use_kernel_cache [protected] |
if kernel cache is used
Definition at line 692 of file SVMLight.h.
int32_t verbosity [protected] |
verbosity level (0-4)
Definition at line 664 of file SVMLight.h.
Matrix that stores the contribution by each kernel for each example (for current alphas)
Definition at line 686 of file SVMLight.h.