forked from shogun-toolbox/shogun
/
Machine.i
167 lines (148 loc) · 4.96 KB
/
Machine.i
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
* This software is distributed under BSD 3-clause license (see LICENSE file).
*
* Authors: Heiko Strathmann, Sergey Lisitsyn
*/
/*%warnfilter(302) apply;
%warnfilter(302) apply_generic;*/
%newobject shogun::CPipelineBuilder::then(const std::string&);
%newobject shogun::CPipelineBuilder::then(const std::string&, CMachine*);
%newobject shogun::CPipelineBuilder::build();
%rename(Machine) CMMachine;
%rename(PipelineBuilder) CPipelineBuilder;
%rename(Pipeline) CPipeline;
%newobject apply();
%newobject apply(CFeatures* data);
%newobject apply_binary();
%newobject apply_binary(CFeatures* data);
%newobject apply_regression();
%newobject apply_regression(CFeatures* data);
%newobject apply_multiclass();
%newobject apply_multiclass(CFeatures* data);
%newobject apply_structured();
%newobject apply_structured(CFeatures* data);
%newobject apply_latent();
%newobject apply_latent(CFeatures* data);
#if defined(SWIGPYTHON) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGLUA) || defined(SWIGR)
%define APPLY_MULTICLASS(CLASS)
%extend CLASS
{
CMulticlassLabels* apply(CFeatures* data=NULL)
{
return $self->apply_multiclass(data);
}
}
%enddef
%define APPLY_BINARY(CLASS)
%extend CLASS
{
CBinaryLabels* apply(CFeatures* data=NULL)
{
return $self->apply_binary(data);
}
}
%enddef
%define APPLY_REGRESSION(CLASS)
%extend CLASS
{
CRegressionLabels* apply(CFeatures* data=NULL)
{
return $self->apply_regression(data);
}
}
%enddef
%define APPLY_STRUCTURED(CLASS)
%extend CLASS
{
CStructuredLabels* apply(CFeatures* data=NULL)
{
return $self->apply_structured(data);
}
}
%enddef
%define APPLY_LATENT(CLASS)
%extend CLASS
{
CLatentLabels* apply(CFeatures* data=NULL)
{
return $self->apply_latent(data);
}
}
%enddef
namespace shogun {
APPLY_MULTICLASS(CMulticlassMachine);
APPLY_MULTICLASS(CKernelMulticlassMachine);
APPLY_MULTICLASS(CLinearMulticlassMachine);
APPLY_MULTICLASS(CDistanceMachine);
APPLY_BINARY(CLinearMachine);
APPLY_BINARY(CKernelMachine);
#ifdef USE_GPL_SHOGUN
APPLY_BINARY(CWDSVMOcas);
#endif //USE_GPL_SHOGUN
APPLY_BINARY(CPluginEstimate);
#ifdef USE_GPL_SHOGUN
APPLY_BINARY(CGaussianProcessClassification);
#endif //USE_GPL_SHOGUN
APPLY_REGRESSION(CLibSVR);
#if USE_SVMLIGHT
APPLY_REGRESSION(CSVRLight);
#endif //USE_SVMLIGHT
APPLY_REGRESSION(CMKLRegression);
#ifdef HAVE_LAPACK
APPLY_REGRESSION(CKernelRidgeRegression);
APPLY_REGRESSION(CLinearRidgeRegression);
APPLY_REGRESSION(CLeastSquaresRegression);
APPLY_REGRESSION(CLeastAngleRegression);
#endif
#ifdef USE_GPL_SHOGUN
APPLY_REGRESSION(CGaussianProcessRegression);
#endif //USE_GPL_SHOGUN
APPLY_STRUCTURED(CStructuredOutputMachine);
APPLY_STRUCTURED(CLinearStructuredOutputMachine);
APPLY_STRUCTURED(CKernelStructuredOutputMachine);
#ifdef USE_MOSEK
APPLY_STRUCTURED(CPrimalMosekSOSVM);
#endif
#ifdef USE_GPL_SHOGUN
APPLY_STRUCTURED(CDualLibQPBMSOSVM);
APPLY_LATENT(CLatentSVM);
#endif //USE_GPL_SHOGUN
}
%rename(apply_generic) CMachine::apply(CFeatures* data=NULL);
%rename(apply_generic) CMulticlassMachine::apply(CFeatures* data=NULL);
%rename(apply_generic) CKernelMulticlassMachine::apply(CFeatures* data=NULL);
%rename(apply_generic) CLinearMulticlassMachine::apply(CFeatures* data=NULL);
%rename(apply_generic) CCDistanceMachineMachine::apply(CFeatures* data=NULL);
%rename(apply_generic) CLinearMachine::apply(CFeatures* data=NULL);
%rename(apply_generic) CKernelMachine::apply(CFeatures* data=NULL);
#ifdef USE_GPL_SHOGUN
%rename(apply_generic) CWDSVMOcas::apply(CFeatures* data=NULL);
#endif //USE_GPL_SHOGUN
%rename(apply_generic) CPluginEstimate::apply(CFeatures* data=NULL);
%rename(apply_generic) CKernelRidgeRegression::apply(CFeatures* data=NULL);
#ifdef USE_SVMLIGHT
%rename(apply_generic) CSVRLight::apply(CFeatures* data=NULL);
#endif //USE_SVMLIGHT
%rename(apply_generic) CLibSVR::apply(CFeatures* data=NULL);
%rename(apply_generic) CMKLRegression::apply(CFeatures* data=NULL);
#ifdef HAVE_LAPACK
%rename(apply_generic) CKernelRidgeRegression::apply(CFeatures* data=NULL);
%rename(apply_generic) CLinearRidgeRegression::apply(CFeatures* data=NULL);
%rename(apply_generic) CLeastSquaresRegression::apply(CFeatures* data=NULL);
%rename(apply_generic) CLeastAngleRegression::apply(CFeatures* data=NULL);
#endif
%rename(apply_generic) CGaussianProcessRegression::apply(CFeatures* data=NULL);
%rename(apply_generic) CStructuredOutputMachine::apply(CFeatures* data=NULL);
%rename(apply_generic) CLinearStructuredOutputMachine::apply(CFeatures* data=NULL);
%rename(apply_generic) CKernelStructuredOutputMachine::apply(CFeatures* data=NULL);
#ifdef USE_MOSEK
%rename(apply_generic) CPrimalMosekSOSVM::apply(CFeatures* data=NULL);
#endif
#undef APPLY_MULTICLASS
#undef APPLY_BINARY
#undef APPLY_REGRESSION
#undef APPLY_STRUCTURED
#undef APPLY_LATENT
%include <shogun/machine/Machine.h>
%include <shogun/machine/Pipeline.h>
#endif