This code take a decision tree, or bagged decision tree trained in matlab using TreeBagger, and converts it to to a c++ class
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
DecTree.m
DecTreeCwrite.m Initial Commit May 7, 2014
DecisionTreeClass.cpp
DecisionTreeClass.hpp
README
example.asv
example.m
extractDecTreeStruct.asv
extractDecTreeStruct.m

README

Introduction
--------------------------------------------------------------------------------
This program takes a decision tree trained in Matlab using TreeBagger or the classification tree function ClassificationTree and outputs a textile containing all the branch information.  This text file can be read by the attached C++ class, and then used to make decisions based on presented features in deployed applications.

It is useful for deploying code developed in matlab into other applications / systems as the TreeBagger class is not included in the matlab Coder. 

Usage
--------------------------------------------------------------------------------
extractDecTreeStruct.m matlab files takes as input a trained ClassificationTree tree or a TreeBagger classification ensemble, and outputs a text file which can be read by the C++ class DTree in DecisionTreeClass.hpp.  in DTree are two methods, readTextFilesTrees reads the decision tree text file outputted by extractDecTreeStruct.m into a number of private arrays.  The method decisionTreeFun, then takes as input a series of features and outputs the class (integer number).  The files must always have the following postfix : _bag_x.txt, where x is the bag number.

For any comments or questions, please email p.kendrick@salford.ac.uk

/*Copyright (c) <2014> <Paul Kendrick>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/