/usr/include/shogun/multiclass/ScatterSVM.h is in libshogun-dev 3.2.0-7.3build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2009 Soeren Sonnenburg
* Written (W) 2009 Marius Kloft
* Copyright (C) 2009 TU Berlin and Max-Planck-Society
*/
#ifndef _SCATTERSVM_H___
#define _SCATTERSVM_H___
#include <shogun/lib/common.h>
#include <shogun/lib/config.h>
#include <shogun/multiclass/MulticlassSVM.h>
#include <shogun/lib/external/shogun_libsvm.h>
#include <stdio.h>
namespace shogun
{
/** scatter svm variant */
enum SCATTER_TYPE
{
/// no bias w/ libsvm
NO_BIAS_LIBSVM,
/// training with bias using test rule 1
TEST_RULE1,
/// training with bias using test rule 2
TEST_RULE2
};
/** @brief ScatterSVM - Multiclass SVM
*
* The ScatterSVM is an unpublished experimental
* true multiclass SVM. Details are availabe
* in the following technical report.
*
* This code is currently experimental.
*
* Robert Jenssen and Marius Kloft and Alexander Zien and S\"oren Sonnenburg and
* Klaus-Robert M\"{u}ller,
* A Multi-Class Support Vector Machine Based on Scatter Criteria, TR 014-2009
* TU Berlin, 2009
*
* */
class CScatterSVM : public CMulticlassSVM
{
public:
/** default constructor */
CScatterSVM();
/** constructor */
CScatterSVM(SCATTER_TYPE type);
/** constructor (using NO_BIAS as default scatter_type)
*
* @param C constant C
* @param k kernel
* @param lab labels
*/
CScatterSVM(float64_t C, CKernel* k, CLabels* lab);
/** default destructor */
virtual ~CScatterSVM();
/** get classifier type
*
* @return classifier type LIBSVM
*/
virtual EMachineType get_classifier_type() { return CT_SCATTERSVM; }
/** classify one example
*
* @param num number of example to classify
* @return resulting classification
*/
virtual float64_t apply_one(int32_t num);
/** classify one vs rest
*
* @return resulting labels
*/
virtual CLabels* classify_one_vs_rest();
/** @return object name */
virtual const char* get_name() const { return "ScatterSVM"; }
protected:
/** train SVM classifier
*
* @param data training data (parameter can be avoided if distance or
* kernel-based classifiers are used and distance/kernels are
* initialized with train data)
*
* @return whether training was successful
*/
virtual bool train_machine(CFeatures* data=NULL);
private:
void compute_norm_wc();
virtual bool train_no_bias_libsvm();
virtual bool train_testrule12();
protected:
/** type of scatter SVM */
SCATTER_TYPE scatter_type;
/** SVM problem */
svm_problem problem;
/** SVM param */
svm_parameter param;
/** SVM model */
struct svm_model* model;
/** norm of w_c */
float64_t* norm_wc;
/** norm of w_cw */
float64_t* norm_wcw;
/** ScatterSVM rho */
float64_t rho;
/** number of classes */
int32_t m_num_classes;
};
}
#endif // ScatterSVM
|