Skip to content

Commit

Permalink
add a couple of missing %templates to Multiclass.i
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Aug 9, 2012
1 parent ac8c5ba commit 4b11e44
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
23 changes: 16 additions & 7 deletions src/interfaces/modular/Multiclass.i
Expand Up @@ -14,8 +14,6 @@
%rename(RandomConditionalProbabilityTree) CRandomConditionalProbabilityTree;
%rename(RelaxedTree) CRelaxedTree;
%rename(RelaxedTreeNodeData) CRelaxedTreeNodeData;
%rename(RelaxedTreeUtil) CRelaxedTreeUtil;
%rename(TreeMachine) CTreeMachine;
%rename(TreeMachineNode) CTreeMachineNode;
%rename(VwConditionalProbabilityTree) VwConditionalProbabilityTree;

Expand Down Expand Up @@ -66,21 +64,26 @@
%rename(ShareBoost) CShareBoost;

/* Include Class Headers to make them visible from within the target language */
%include <shogun/multiclass/tree/BalancedConditionalProbabilityTree.h>
%include <shogun/machine/BaseMulticlassMachine.h>
%include <shogun/multiclass/tree/TreeMachine.h>
%include <shogun/multiclass/tree/RelaxedTreeNodeData.h>
%include <shogun/multiclass/tree/ConditionalProbabilityTree.h>
namespace shogun
{
%template(TreeMachineWithConditionalProbabilityTreeNodeData) CTreeMachine<ConditionalProbabilityTreeNodeData>;
%template(TreeMachineWithRelaxedTreeNodeData) CTreeMachine<RelaxedTreeNodeData>;
}

%include <shogun/multiclass/tree/BalancedConditionalProbabilityTree.h>
%include <shogun/multiclass/tree/RandomConditionalProbabilityTree.h>
%include <shogun/multiclass/tree/RelaxedTree.h>
%include <shogun/multiclass/tree/RelaxedTreeNodeData.h>
%include <shogun/multiclass/tree/RelaxedTreeUtil.h>
%include <shogun/multiclass/tree/TreeMachine.h>
%include <shogun/multiclass/tree/TreeMachineNode.h>
%include <shogun/multiclass/tree/VwConditionalProbabilityTree.h>

%include <shogun/multiclass/RejectionStrategy.h>
%include <shogun/multiclass/MulticlassStrategy.h>
%include <shogun/multiclass/MulticlassOneVsRestStrategy.h>
%include <shogun/multiclass/MulticlassOneVsOneStrategy.h>
%include <shogun/machine/BaseMulticlassMachine.h>
%include <shogun/machine/MulticlassMachine.h>
%include <shogun/machine/NativeMulticlassMachine.h>
%include <shogun/machine/LinearMulticlassMachine.h>
Expand Down Expand Up @@ -116,3 +119,9 @@
%include <shogun/multiclass/GaussianNaiveBayes.h>
%include <shogun/multiclass/QDA.h>
%include <shogun/multiclass/ShareBoost.h>

namespace shogun
{
SERIALIZABLE_DUMMY(ConditionalProbabilityTreeNodeData);
SERIALIZABLE_DUMMY(RelaxedTreeNodeData);
}
6 changes: 3 additions & 3 deletions src/interfaces/modular/Multiclass_includes.i
@@ -1,11 +1,11 @@
%{
#include <shogun/multiclass/tree/BalancedConditionalProbabilityTree.h>
#include <shogun/multiclass/tree/TreeMachine.h>
#include <shogun/multiclass/tree/RelaxedTreeNodeData.h>
#include <shogun/multiclass/tree/ConditionalProbabilityTree.h>
#include <shogun/multiclass/tree/BalancedConditionalProbabilityTree.h>
#include <shogun/multiclass/tree/RandomConditionalProbabilityTree.h>
#include <shogun/multiclass/tree/RelaxedTree.h>
#include <shogun/multiclass/tree/RelaxedTreeNodeData.h>
#include <shogun/multiclass/tree/RelaxedTreeUtil.h>
#include <shogun/multiclass/tree/TreeMachine.h>
#include <shogun/multiclass/tree/TreeMachineNode.h>
#include <shogun/multiclass/tree/VwConditionalProbabilityTree.h>

Expand Down
4 changes: 0 additions & 4 deletions src/interfaces/modular/modshogun_ignores.i
Expand Up @@ -187,7 +187,3 @@
%ignore shogun::CSerializableFile::write_type_end;

%ignore shogun::CMosek;

%ignore shogun::ConditionalProbabilityTreeNodeData;
%ignore shogun::RelaxedTreeNodeData;
%ignore shogun::RelaxedTreeUtil;
3 changes: 1 addition & 2 deletions src/shogun/multiclass/tree/RelaxedTree.h
Expand Up @@ -73,8 +73,7 @@ class CRelaxedTree: public CTreeMachine<RelaxedTreeNodeData>
virtual void set_labels(CLabels* lab)
{
CMulticlassLabels *mlab = dynamic_cast<CMulticlassLabels *>(lab);
if (lab == NULL)
SG_ERROR("requires MulticlassLabes\n");
REQUIRE(lab, "requires MulticlassLabes\n");

CMachine::set_labels(mlab);
m_num_classes = mlab->get_num_classes();
Expand Down
8 changes: 4 additions & 4 deletions src/shogun/multiclass/tree/TreeMachineNode.h
Expand Up @@ -17,7 +17,7 @@
namespace shogun
{

template <typename data_t>
template <typename T>
class CTreeMachineNode
: public CSGObject
{
Expand Down Expand Up @@ -102,12 +102,12 @@ class CTreeMachineNode
}

/** extra data carried by the tree node */
data_t data;
T data;

/** debug print the tree structure
* @param data_print_func the function to print the data payload
*/
typedef void (*data_print_func_t) (const data_t&);
typedef void (*data_print_func_t) (const T&);
void debug_print(data_print_func_t data_print_func)
{
debug_print_impl(data_print_func, this, 0);
Expand All @@ -119,7 +119,7 @@ class CTreeMachineNode
CTreeMachineNode *m_parent; ///< parent node
int32_t m_machine; ///< machine index associated with this node

static void debug_print_impl(data_print_func_t data_print_func, CTreeMachineNode<data_t> *node, int32_t depth)
static void debug_print_impl(data_print_func_t data_print_func, CTreeMachineNode<T> *node, int32_t depth)
{
for (int32_t i=0; i < depth; ++i)
SG_SPRINT(" ");
Expand Down

0 comments on commit 4b11e44

Please sign in to comment.