Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Feb 11, 2012
2 parents b19e502 + 1e8d8f3 commit 4af1dff
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/shogun/classifier/LPBoost.cpp
Expand Up @@ -23,7 +23,7 @@
using namespace shogun;

CLPBoost::CLPBoost()
: CLinearClassifier(), C1(1), C2(1), use_bias(true), epsilon(1e-3)
: CLinearMachine(), C1(1), C2(1), use_bias(true), epsilon(1e-3)
{
u=NULL;
dim=NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/classifier/LPBoost.h
Expand Up @@ -45,7 +45,7 @@ namespace shogun
*
* \sa CLPM
*/
class CLPBoost : public CLinearClassifier
class CLPBoost : public CLinearMachine
{
public:
CLPBoost();
Expand All @@ -69,7 +69,7 @@ class CLPBoost : public CLinearClassifier
feat->get_feature_type() != F_DREAL)
SG_ERROR("LPBoost requires SPARSE REAL valued features\n");

CLinearClassifier::set_features(feat);
CLinearMachine::set_features(feat);
}

/** set C
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/classifier/LPM.cpp
Expand Up @@ -20,7 +20,7 @@
using namespace shogun;

CLPM::CLPM()
: CLinearClassifier(), C1(1), C2(1), use_bias(true), epsilon(1e-3)
: CLinearMachine(), C1(1), C2(1), use_bias(true), epsilon(1e-3)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/shogun/classifier/LPM.h
Expand Up @@ -40,7 +40,7 @@ namespace shogun
*
* \sa CLPBoost
*/
class CLPM : public CLinearClassifier
class CLPM : public CLinearMachine
{
public:
CLPM();
Expand All @@ -61,7 +61,7 @@ class CLPM : public CLinearClassifier
feat->get_feature_type() != F_DREAL)
SG_ERROR("LPM requires SPARSE REAL valued features\n");

CLinearClassifier::set_features(feat);
CLinearMachine::set_features(feat);
}

/** set C
Expand Down
10 changes: 5 additions & 5 deletions src/shogun/classifier/SubGradientLPM.cpp
Expand Up @@ -18,7 +18,7 @@
#include <shogun/lib/Time.h>
#include <shogun/machine/LinearMachine.h>
#include <shogun/classifier/SubGradientLPM.h>
#include <shogun/classifier/svm/qpbsvmlib.h>
#include <shogun/classifier/svm/QPBSVMLib.h>
#include <shogun/features/DotFeatures.h>
#include <shogun/features/Labels.h>

Expand All @@ -27,18 +27,18 @@ using namespace shogun;
#define DEBUG_SUBGRADIENTLPM

CSubGradientLPM::CSubGradientLPM()
: CLinearClassifier(), C1(1), C2(1), epsilon(1e-5), qpsize(42),
: CLinearMachine(), C1(1), C2(1), epsilon(1e-5), qpsize(42),
qpsize_max(2000), use_bias(false), delta_active(0), delta_bound(0)
{
}

CSubGradientLPM::CSubGradientLPM(
float64_t C, CDotFeatures* traindat, CLabels* trainlab)
: CLinearClassifier(), C1(C), C2(C), epsilon(1e-5), qpsize(42),
: CLinearMachine(), C1(C), C2(C), epsilon(1e-5), qpsize(42),
qpsize_max(2000), use_bias(false), delta_active(0), delta_bound(0)
{
CLinearClassifier::features=traindat;
CClassifier::labels=trainlab;
CLinearMachine::features=traindat;
CLinearMachine::labels=trainlab;
}


Expand Down
2 changes: 1 addition & 1 deletion src/shogun/classifier/SubGradientLPM.h
Expand Up @@ -45,7 +45,7 @@ namespace shogun
* \sa CLPBoost
* \sa CLPM
*/
class CSubGradientLPM : public CLinearClassifier
class CSubGradientLPM : public CLinearMachine
{
public:
CSubGradientLPM();
Expand Down
8 changes: 5 additions & 3 deletions src/shogun/classifier/svm/CPLEXSVM.cpp
Expand Up @@ -44,8 +44,10 @@ bool CCPLEXSVM::train_machine(CFeatures* data)
{
int32_t n,m;
int32_t num_label=0;
float64_t* y = labels->get_labels(num_label);
float64_t* H = kernel->get_kernel_matrix<float64_t>(m, n, NULL);
SGVector<float64_t> y=labels->get_labels();
SGMatrix<float64_t> H=kernel->get_kernel_matrix();
m=H.num_rows;
n=H.num_cols;
ASSERT(n>0 && n==m && n==num_label);
float64_t* alphas=SG_MALLOC(float64_t, n);
float64_t* lb=SG_MALLOC(float64_t, n);
Expand Down Expand Up @@ -82,7 +84,7 @@ bool CCPLEXSVM::train_machine(CFeatures* data)
SG_FREE(alphas);
SG_FREE(lb);
SG_FREE(ub);
SG_FREE(H);
H.destroy_matrix();

result = true;
}
Expand Down
10 changes: 5 additions & 5 deletions src/shogun/mathematics/Cplex.cpp
Expand Up @@ -150,7 +150,7 @@ bool CCplex::setup_subgradientlpm_QP(
int32_t vlen=0;
bool vfree=false;
//SG_PRINT("idx=%d\n", idx);
SGSparseVectorEntry<float64_t>* vec=features->get_sparse_feature_vector(idx, vlen, vfree);
SGSparseVector<float64_t> vec=features->get_sparse_feature_vector(idx);
//SG_PRINT("vlen=%d\n", vlen);

cmatbeg[i]=offs;
Expand All @@ -162,11 +162,11 @@ bool CCplex::setup_subgradientlpm_QP(
{
for (int32_t j=0; j<vlen; j++)
{
cmatind[offs]=vec[j].feat_index;
cmatval[offs]=-val*vec[j].entry;
cmatind[offs]=vec.features[j].feat_index;
cmatval[offs]=-val*vec.features[j].entry;
offs++;
ASSERT(offs<cmatsize);
//SG_PRINT("vec[%d]=%10.10f\n", j, vec[j].entry);
//SG_PRINT("vec[%d]=%10.10f\n", j, vec.features[j].entry);
}

if (use_bias)
Expand All @@ -192,7 +192,7 @@ bool CCplex::setup_subgradientlpm_QP(
ASSERT(offs<cmatsize);
}

features->free_feature_vector(vec, idx, vfree);
features->free_feature_vector(vec, idx);
}
}

Expand Down

0 comments on commit 4af1dff

Please sign in to comment.