Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Proof of concept: problem type #538

Merged
merged 4 commits into from

2 participants

This page is out of date. Refresh to see the latest.
Showing with 84 additions and 12 deletions.
  1. +2 −0  src/shogun/classifier/AveragedPerceptron.h
  2. +2 −0  src/shogun/classifier/LDA.h
  3. +2 −0  src/shogun/classifier/LPBoost.h
  4. +2 −0  src/shogun/classifier/LPM.h
  5. +2 −0  src/shogun/classifier/NearestCentroid.h
  6. +2 −0  src/shogun/classifier/Perceptron.h
  7. +2 −0  src/shogun/classifier/PluginEstimate.h
  8. +2 −0  src/shogun/classifier/SubGradientLPM.h
  9. +2 −0  src/shogun/classifier/svm/LibLinear.h
  10. +2 −0  src/shogun/classifier/svm/NewtonSVM.h
  11. +2 −0  src/shogun/classifier/svm/OnlineLibLinear.h
  12. +2 −0  src/shogun/classifier/svm/OnlineSVMSGD.h
  13. +2 −0  src/shogun/classifier/svm/SGDQN.h
  14. +2 −0  src/shogun/classifier/svm/SVM.h
  15. +2 −0  src/shogun/classifier/svm/SVMLin.h
  16. +2 −0  src/shogun/classifier/svm/SVMOcas.h
  17. +2 −0  src/shogun/classifier/svm/SVMSGD.h
  18. +2 −0  src/shogun/classifier/svm/SubGradientSVM.h
  19. +1 −2  src/shogun/classifier/svm/WDSVMOcas.cpp
  20. +2 −0  src/shogun/classifier/svm/WDSVMOcas.h
  21. +2 −0  src/shogun/classifier/vw/VowpalWabbit.h
  22. +5 −1 src/shogun/machine/Machine.h
  23. +2 −0  src/shogun/multiclass/ConjugateIndex.h
  24. +2 −0  src/shogun/multiclass/GaussianNaiveBayes.h
  25. +2 −0  src/shogun/multiclass/KNN.h
  26. +2 −0  src/shogun/multiclass/MulticlassLibLinear.h
  27. +2 −0  src/shogun/multiclass/MulticlassOCAS.h
  28. +2 −0  src/shogun/multiclass/MulticlassSVM.h
  29. +2 −0  src/shogun/multiclass/QDA.h
  30. +10 −9 src/shogun/regression/GaussianProcessRegression.h
  31. +2 −0  src/shogun/regression/KernelRidgeRegression.h
  32. +2 −0  src/shogun/regression/LeastAngleRegression.h
  33. +2 −0  src/shogun/regression/LeastSquaresRegression.h
  34. +2 −0  src/shogun/regression/LinearRidgeRegression.h
  35. +2 −0  src/shogun/regression/svr/LibSVR.h
  36. +2 −0  src/shogun/regression/svr/MKLRegression.h
  37. +2 −0  src/shogun/regression/svr/SVRLight.h
View
2  src/shogun/classifier/AveragedPerceptron.h
@@ -30,6 +30,8 @@ namespace shogun
class CAveragedPerceptron : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CAveragedPerceptron();
View
2  src/shogun/classifier/LDA.h
@@ -52,6 +52,8 @@ namespace shogun
class CLDA : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** constructor
*
* @param gamma gamma
View
2  src/shogun/classifier/LPBoost.h
@@ -48,6 +48,8 @@ namespace shogun
class CLPBoost : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
CLPBoost();
virtual ~CLPBoost();
View
2  src/shogun/classifier/LPM.h
@@ -43,6 +43,8 @@ namespace shogun
class CLPM : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
CLPM();
virtual ~CLPM();
View
2  src/shogun/classifier/NearestCentroid.h
@@ -33,6 +33,8 @@ class CDistanceMachine;
class CNearestCentroid : public CDistanceMachine{
public:
+ MACHINE_PROBLEM_TYPE(PT_MULTICLASS);
+
/**
* Default constructor
*/
View
2  src/shogun/classifier/Perceptron.h
@@ -30,6 +30,8 @@ namespace shogun
class CPerceptron : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CPerceptron();
View
2  src/shogun/classifier/PluginEstimate.h
@@ -34,6 +34,8 @@ namespace shogun
class CPluginEstimate: public CMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor
* @param pos_pseudo pseudo for positive model
* @param neg_pseudo pseudo for negative model
View
2  src/shogun/classifier/SubGradientLPM.h
@@ -48,6 +48,8 @@ namespace shogun
class CSubGradientLPM : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
CSubGradientLPM();
CSubGradientLPM(
float64_t C, CDotFeatures* traindat,
View
2  src/shogun/classifier/svm/LibLinear.h
@@ -45,6 +45,8 @@ namespace shogun
class CLibLinear : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CLibLinear();
View
2  src/shogun/classifier/svm/NewtonSVM.h
@@ -27,6 +27,8 @@ namespace shogun
class CNewtonSVM : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CNewtonSVM();
View
2  src/shogun/classifier/svm/OnlineLibLinear.h
@@ -26,6 +26,8 @@ namespace shogun
class COnlineLibLinear : public COnlineLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** Default constructor */
COnlineLibLinear();
View
2  src/shogun/classifier/svm/OnlineSVMSGD.h
@@ -33,6 +33,8 @@ namespace shogun
class COnlineSVMSGD : public COnlineLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
COnlineSVMSGD();
View
2  src/shogun/classifier/svm/SGDQN.h
@@ -34,6 +34,8 @@ namespace shogun
class CSGDQN : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CSGDQN();
View
2  src/shogun/classifier/svm/SVM.h
@@ -47,6 +47,8 @@ class CMulticlassSVM;
class CSVM : public CKernelMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** Create an empty Support Vector Machine Object
* @param num_sv with num_sv support vectors
*/
View
2  src/shogun/classifier/svm/SVMLin.h
@@ -22,6 +22,8 @@ namespace shogun
class CSVMLin : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CSVMLin();
View
2  src/shogun/classifier/svm/SVMOcas.h
@@ -32,6 +32,8 @@ enum E_SVM_TYPE
class CSVMOcas : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CSVMOcas();
View
2  src/shogun/classifier/svm/SVMSGD.h
@@ -34,6 +34,8 @@ namespace shogun
class CSVMSGD : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CSVMSGD();
View
2  src/shogun/classifier/svm/SubGradientSVM.h
@@ -23,6 +23,8 @@ namespace shogun
class CSubGradientSVM : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CSubGradientSVM();
View
3  src/shogun/classifier/svm/WDSVMOcas.cpp
@@ -21,7 +21,6 @@
#include <shogun/features/Alphabet.h>
#include <shogun/labels/Labels.h>
#include <shogun/labels/BinaryLabels.h>
-#include <shogun/labels/RegressionLabels.h>
using namespace shogun;
@@ -120,7 +119,7 @@ CLabels* CWDSVMOcas::apply(CFeatures* data)
int32_t num=features->get_num_vectors();
ASSERT(num>0);
- CRegressionLabels* output=new CRegressionLabels(num);
+ CBinaryLabels* output=new CBinaryLabels(num);
SG_REF(output);
for (int32_t i=0; i<num; i++)
View
2  src/shogun/classifier/svm/WDSVMOcas.h
@@ -26,6 +26,8 @@ template <class ST> class CStringFeatures;
class CWDSVMOcas : public CMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/** default constructor */
CWDSVMOcas();
View
2  src/shogun/classifier/vw/VowpalWabbit.h
@@ -38,6 +38,8 @@ namespace shogun
class CVowpalWabbit: public COnlineLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_BINARY);
+
/**
* Default constructor
*/
View
6 src/shogun/machine/Machine.h
@@ -99,6 +99,8 @@ enum EProblemType
PT_MULTICLASS = 2
};
+#define MACHINE_PROBLEM_TYPE(PT) inline virtual EProblemType get_machine_problem_type() const { return PT; }
+
/** @brief A generic learning machine interface.
*
* A machine takes as input CFeatures and (optionally) CLabels.
@@ -244,8 +246,10 @@ class CMachine : public CSGObject
/** @return whether this machine is locked */
bool is_data_locked() const { return m_data_locked; }
- virtual EProblemType get_machine_problem_type() const
+ //TODO change to pure virtual
+ inline virtual EProblemType get_machine_problem_type() const
{
+ SG_NOTIMPLEMENTED;
return PT_BINARY;
}
View
2  src/shogun/multiclass/ConjugateIndex.h
@@ -35,6 +35,8 @@ class CConjugateIndex : public CMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_MULTICLASS)
+
/** default constructor
*
*/
View
2  src/shogun/multiclass/GaussianNaiveBayes.h
@@ -36,6 +36,8 @@ class CGaussianNaiveBayes : public CNativeMulticlassMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_MULTICLASS)
+
/** default constructor
*
*/
View
2  src/shogun/multiclass/KNN.h
@@ -55,6 +55,8 @@ class CDistanceMachine;
class CKNN : public CDistanceMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_MULTICLASS)
+
/** default constructor */
CKNN();
View
2  src/shogun/multiclass/MulticlassLibLinear.h
@@ -37,6 +37,8 @@ namespace shogun
class CMulticlassLibLinear : public CLinearMulticlassMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_MULTICLASS)
+
/** default constructor */
CMulticlassLibLinear();
View
2  src/shogun/multiclass/MulticlassOCAS.h
@@ -23,6 +23,8 @@ namespace shogun
class CMulticlassOCAS : public CLinearMulticlassMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_MULTICLASS)
+
/** default constructor */
CMulticlassOCAS();
View
2  src/shogun/multiclass/MulticlassSVM.h
@@ -26,6 +26,8 @@ class CSVM;
class CMulticlassSVM : public CKernelMulticlassMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_MULTICLASS);
+
/** default constructor */
CMulticlassSVM();
View
2  src/shogun/multiclass/QDA.h
@@ -36,6 +36,8 @@ namespace shogun
class CQDA : public CNativeMulticlassMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_MULTICLASS)
+
/** constructor
*
* @param tolerance tolerance used in training
View
19 src/shogun/regression/GaussianProcessRegression.h
@@ -38,16 +38,17 @@ namespace shogun
class CGaussianProcessRegression : public CMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_REGRESSION);
- /** constructor
- *
- * @param sigma variance of the Gaussian observation noise
- * @param k Kernel for covariance matrix
- * @param data training data
- * @param lab labels
- */
- CGaussianProcessRegression(float64_t sigma, CKernel* k,
- CDenseFeatures<float64_t>* data, CLabels* lab);
+ /** constructor
+ *
+ * @param sigma variance of the Gaussian observation noise
+ * @param k Kernel for covariance matrix
+ * @param data training data
+ * @param lab labels
+ */
+ CGaussianProcessRegression(float64_t sigma, CKernel* k,
+ CDenseFeatures<float64_t>* data, CLabels* lab);
/** default constructor */
CGaussianProcessRegression();
View
2  src/shogun/regression/KernelRidgeRegression.h
@@ -64,6 +64,8 @@ enum ETrainingType
class CKernelRidgeRegression : public CKernelMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_REGRESSION);
+
/** default constructor */
CKernelRidgeRegression();
View
2  src/shogun/regression/LeastAngleRegression.h
@@ -72,6 +72,8 @@ class CFeatures;
class CLeastAngleRegression: public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_REGRESSION);
+
/** default constructor
*
* @param lasso - when true, it runs the LASSO, when false, it runs LARS
View
2  src/shogun/regression/LeastSquaresRegression.h
@@ -40,6 +40,8 @@ namespace shogun
class CLeastSquaresRegression : public CLinearRidgeRegression
{
public:
+ MACHINE_PROBLEM_TYPE(PT_REGRESSION);
+
/** default constructor */
CLeastSquaresRegression();
View
2  src/shogun/regression/LinearRidgeRegression.h
@@ -42,6 +42,8 @@ namespace shogun
class CLinearRidgeRegression : public CLinearMachine
{
public:
+ MACHINE_PROBLEM_TYPE(PT_REGRESSION);
+
/** default constructor */
CLinearRidgeRegression();
View
2  src/shogun/regression/svr/LibSVR.h
@@ -51,6 +51,8 @@ namespace shogun
class CLibSVR : public CSVM
{
public:
+ MACHINE_PROBLEM_TYPE(PT_REGRESSION);
+
/** default constructor */
CLibSVR();
View
2  src/shogun/regression/svr/MKLRegression.h
@@ -25,6 +25,8 @@ namespace shogun
class CMKLRegression : public CMKL
{
public:
+ MACHINE_PROBLEM_TYPE(PT_REGRESSION);
+
/** Constructor
*
* @param s SVM to use as constraint generator in MKL SILP
View
2  src/shogun/regression/svr/SVRLight.h
@@ -62,6 +62,8 @@ namespace shogun
class CSVRLight: public CSVMLight
{
public:
+ MACHINE_PROBLEM_TYPE(PT_REGRESSION);
+
/** default constructor */
CSVRLight();
Something went wrong with that request. Please try again.