Skip to content

Commit

Permalink
Fixed compilation of DA MC Liblinear
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed May 20, 2012
1 parent da70cf4 commit 788043e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/shogun/machine/MulticlassMachine.cpp
Expand Up @@ -75,11 +75,11 @@ CRealLabels* CMulticlassMachine::apply(CFeatures* features)
return apply();
}

CLabels* CMulticlassMachine::get_submachine_outputs(int32_t i)
CRealLabels* CMulticlassMachine::get_submachine_outputs(int32_t i)
{
CMachine *machine = (CMachine*)m_machines->get_element(i);
ASSERT(machine);
CLabels* output = machine->apply();
CRealLabels* output = (CRealLabels*)machine->apply();
SG_UNREF(machine);
return output;
}
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/machine/MulticlassMachine.h
Expand Up @@ -85,7 +85,7 @@ class CMulticlassMachine : public CMachine
* @param i number of submachine
* @return outputs
*/
virtual CLabels* get_submachine_outputs(int32_t i);
virtual CRealLabels* get_submachine_outputs(int32_t i);

/** get output of i-th submachine for num-th vector
* @param i number of submachine
Expand Down
Expand Up @@ -11,6 +11,7 @@
#include <shogun/lib/config.h>
#ifdef HAVE_LAPACK
#include <shogun/transfer/domain_adaptation/DomainAdaptationMulticlassLibLinear.h>
#include <shogun/labels/MulticlassLabels.h>

using namespace shogun;

Expand Down Expand Up @@ -90,7 +91,7 @@ CDomainAdaptationMulticlassLibLinear::~CDomainAdaptationMulticlassLibLinear()
SGMatrix<float64_t> CDomainAdaptationMulticlassLibLinear::obtain_regularizer_matrix() const
{
ASSERT(get_use_bias()==false);
int32_t n_classes = m_source_machine->get_labels()->get_num_classes();
int32_t n_classes = ((CMulticlassLabels*)m_source_machine->get_labels())->get_num_classes();
int32_t n_features = ((CDotFeatures*)m_source_machine->get_features())->get_dim_feature_space();
SGMatrix<float64_t> w0(n_classes,n_features);

Expand All @@ -104,10 +105,10 @@ SGMatrix<float64_t> CDomainAdaptationMulticlassLibLinear::obtain_regularizer_mat
return w0;
}

CLabels* CDomainAdaptationMulticlassLibLinear::get_submachine_outputs(int32_t i)
CRealLabels* CDomainAdaptationMulticlassLibLinear::get_submachine_outputs(int32_t i)
{
CLabels* target_outputs = CMulticlassMachine::get_submachine_outputs(i);
CLabels* source_outputs = m_source_machine->get_submachine_outputs(i);
CRealLabels* target_outputs = CMulticlassMachine::get_submachine_outputs(i);
CRealLabels* source_outputs = m_source_machine->get_submachine_outputs(i);
int32_t n_target_outputs = target_outputs->get_num_labels();
ASSERT(n_target_outputs==source_outputs->get_num_labels());
SGVector<float64_t> result(n_target_outputs);
Expand All @@ -117,6 +118,6 @@ CLabels* CDomainAdaptationMulticlassLibLinear::get_submachine_outputs(int32_t i)
SG_UNREF(target_outputs);
SG_UNREF(source_outputs);

return new CLabels(result);
return new CRealLabels(result);
}
#endif /* HAVE_LAPACK */
Expand Up @@ -40,7 +40,7 @@ class CDomainAdaptationMulticlassLibLinear : public CMulticlassLibLinear
virtual ~CDomainAdaptationMulticlassLibLinear();

/** get submachine outputs */
virtual CLabels* get_submachine_outputs(int32_t);
virtual CRealLabels* get_submachine_outputs(int32_t);

/** get name */
virtual const char* get_name() const
Expand Down

0 comments on commit 788043e

Please sign in to comment.