Skip to content

Commit

Permalink
Merge pull request #2580 from iglesias/fix_warnings
Browse files Browse the repository at this point in the history
Fix CARTree warning.
  • Loading branch information
iglesias committed Oct 28, 2014
2 parents ee8a8d2 + 0bb5557 commit 44aea24
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions doc/ipython-notebooks/multiclass/Tree/DecisionTrees.ipynb
Expand Up @@ -1051,9 +1051,9 @@
"from modshogun import PT_MULTICLASS, CARTree\n",
"from numpy import array\n",
"\n",
"def train_carttree(feat_types,num_folds,problem_type,use_cv_pruning,labels,features):\n",
"def train_carttree(feat_types,problem_type,num_folds,use_cv_pruning,labels,features):\n",
" # create CART tree object\n",
" c = CARTree(feat_types,num_folds,problem_type,use_cv_pruning)\n",
" c = CARTree(feat_types,problem_type,num_folds,use_cv_pruning)\n",
" # set training labels\n",
" c.set_labels(labels)\n",
" # train using training features\n",
Expand All @@ -1065,7 +1065,7 @@
"ft = array([True, False])\n",
"\n",
"# get back trained tree\n",
"cart = train_carttree(ft, 5, PT_MULTICLASS, True, train_labels, train_feats)"
"cart = train_carttree(ft, PT_MULTICLASS, 5, True, train_labels, train_feats)"
],
"language": "python",
"metadata": {},
Expand Down Expand Up @@ -1177,7 +1177,7 @@
"feat_type = array([False])\n",
"\n",
"# get back trained tree\n",
"cart = train_carttree(feat_type, 5, PT_REGRESSION, True, train_labels, train_feats)"
"cart = train_carttree(feat_type, PT_REGRESSION, 5, True, train_labels, train_feats)"
],
"language": "python",
"metadata": {},
Expand Down Expand Up @@ -1292,7 +1292,7 @@
"feature_types = array([False, False, False, False])\n",
"\n",
"# setup CART-tree with cross validation pruning switched off\n",
"cart = CARTree(feature_types,5,PT_MULTICLASS,False)"
"cart = CARTree(feature_types,PT_MULTICLASS,5,False)"
],
"language": "python",
"metadata": {},
Expand Down Expand Up @@ -1409,7 +1409,7 @@
" # set attribute types - 2 nominal and 2 ordinal\n",
" feature_types = array([True, True, False, False])\n",
" # setup CART-tree with cross validation pruning switched off\n",
" cart = CARTree(feature_types,5,PT_REGRESSION,False)\n",
" cart = CARTree(feature_types,PT_REGRESSION,5,False)\n",
" # set max allowed depth\n",
" cart.set_max_depth(max_depth)\n",
"\n",
Expand Down Expand Up @@ -1846,4 +1846,4 @@
"metadata": {}
}
]
}
}
4 changes: 2 additions & 2 deletions doc/ipython-notebooks/multiclass/Tree/TreeEnsemble.ipynb
Expand Up @@ -150,7 +150,7 @@
"from modshogun import CARTree, PT_MULTICLASS\n",
"\n",
"def train_cart(train_feats,train_labels,feature_types,problem_type):\n",
" c=CARTree(feature_types,2,problem_type,False)\n",
" c=CARTree(feature_types,problem_type,2,False)\n",
" c.set_labels(train_labels)\n",
" c.train(train_feats)\n",
" \n",
Expand Down Expand Up @@ -514,4 +514,4 @@
"metadata": {}
}
]
}
}
Expand Up @@ -23,7 +23,7 @@ def multiclass_cartree_modular(train=traindat,test=testdat,labels=label_traindat
train_labels=MulticlassLabels(CSVFile(labels))

# CART Tree formation with 5 fold cross-validation pruning
c=CARTree(ft,5,PT_MULTICLASS,True)
c=CARTree(ft,PT_MULTICLASS,5,True)
c.set_labels(train_labels)
c.train(feats_train)

Expand Down
Expand Up @@ -29,7 +29,7 @@ def regression_cartree_modular(num_train=500,num_test=50,x_range=15,noise_var=0.
train_labels=RegressionLabels(Y_train[0])

# CART Tree formation
c=CARTree(ft,5,PT_REGRESSION,True)
c=CARTree(ft,PT_REGRESSION,5,True)
c.set_labels(train_labels)
c.train(feats_train)

Expand Down
2 changes: 1 addition & 1 deletion src/shogun/multiclass/tree/CARTree.cpp
Expand Up @@ -51,7 +51,7 @@ CCARTree::CCARTree(SGVector<bool> attribute_types, EProblemType prob_type)
set_machine_problem_type(prob_type);
}

CCARTree::CCARTree(SGVector<bool> attribute_types, int32_t num_folds, EProblemType prob_type, bool cv_prune)
CCARTree::CCARTree(SGVector<bool> attribute_types, EProblemType prob_type, int32_t num_folds, bool cv_prune)
: CTreeMachine<CARTreeNodeData>()
{
init();
Expand Down
8 changes: 4 additions & 4 deletions src/shogun/multiclass/tree/CARTree.h
Expand Up @@ -89,12 +89,12 @@ class CCARTree : public CTreeMachine<CARTreeNodeData>
CCARTree(SGVector<bool> attribute_types, EProblemType prob_type=PT_MULTICLASS);

/** constructor - to be used while using cross-validation pruning
* @param attribute_types type of each predictive attribute (true for nominal, false for ordinal/continuous)
* @param attribute_types type of each predictive attribute (true for nominal, false for ordinal/continuous)
* @param prob_type machine problem type - PT_MULTICLASS or PT_REGRESSION
* @param num_folds number of subsets used in cross-valiation
* @param prob_type machine problem type - PT_MULTICLASS or PT_REGRESSION
* @param cv_prune - whether to use cross-validation pruning, True by default
* @param cv_prune - whether to use cross-validation pruning
*/
CCARTree(SGVector<bool> attribute_types, int32_t num_folds, EProblemType prob_type=PT_MULTICLASS, bool cv_prune=true);
CCARTree(SGVector<bool> attribute_types, EProblemType prob_type, int32_t num_folds, bool cv_prune);

/** destructor */
virtual ~CCARTree();
Expand Down

0 comments on commit 44aea24

Please sign in to comment.