From 3c9e8dcf7e1f73e911a52742961c2f9b4c14541d Mon Sep 17 00:00:00 2001 From: Kathryn Iverson Date: Fri, 16 Nov 2012 15:53:32 -0500 Subject: [PATCH] added files for regularized random forest --- Mothur.xcodeproj/project.pbxproj | 12 +++++++ regularizeddecisiontree.cpp | 9 +++++ regularizeddecisiontree.h | 16 +++++++++ regularizedrandomforest.cpp | 57 ++++++++++++++++++++++++++++++++ regularizedrandomforest.h | 30 +++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100644 regularizeddecisiontree.cpp create mode 100644 regularizeddecisiontree.h create mode 100644 regularizedrandomforest.cpp create mode 100644 regularizedrandomforest.h diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index d360d2f..c5ea99c 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -10,6 +10,8 @@ 219C1DE01552C4BD004209F9 /* newcommandtemplate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 219C1DDF1552C4BD004209F9 /* newcommandtemplate.cpp */; }; 219C1DE41559BCCF004209F9 /* getcoremicrobiomecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 219C1DE31559BCCD004209F9 /* getcoremicrobiomecommand.cpp */; }; 7E6BE10A12F710D8007ADDBE /* refchimeratest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E6BE10912F710D8007ADDBE /* refchimeratest.cpp */; }; + 834D9D581656D7C400E7FAB9 /* regularizedrandomforest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */; }; + 834D9D5C1656DEC800E7FAB9 /* regularizeddecisiontree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 834D9D5A1656DEC700E7FAB9 /* regularizeddecisiontree.cpp */; }; 83F25B0C163B031200ABE73D /* forest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F25B0A163B031200ABE73D /* forest.cpp */; }; 8DD76FB00486AB0100D96B5E /* mothur.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6A0FF2C0290799A04C91782 /* mothur.1 */; }; A70056E6156A93D000924A2D /* getotulabelscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70056E5156A93D000924A2D /* getotulabelscommand.cpp */; }; @@ -385,6 +387,10 @@ 7E6BE10812F710D8007ADDBE /* refchimeratest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = refchimeratest.h; sourceTree = ""; }; 7E6BE10912F710D8007ADDBE /* refchimeratest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = refchimeratest.cpp; sourceTree = ""; }; 7E78911B135F3E8600E725D2 /* eachgapdistignorens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eachgapdistignorens.h; sourceTree = ""; }; + 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = regularizedrandomforest.cpp; sourceTree = ""; }; + 834D9D571656D7C400E7FAB9 /* regularizedrandomforest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regularizedrandomforest.h; sourceTree = ""; }; + 834D9D5A1656DEC700E7FAB9 /* regularizeddecisiontree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = regularizeddecisiontree.cpp; sourceTree = ""; }; + 834D9D5B1656DEC700E7FAB9 /* regularizeddecisiontree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regularizeddecisiontree.h; sourceTree = ""; }; 83F25B0A163B031200ABE73D /* forest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = forest.cpp; sourceTree = ""; }; 83F25B0B163B031200ABE73D /* forest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = forest.h; sourceTree = ""; }; 8DD76FB20486AB0100D96B5E /* mothur */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mothur; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1227,6 +1233,10 @@ A77E193A161B289600DB1A2A /* rftreenode.cpp */, 83F25B0A163B031200ABE73D /* forest.cpp */, 83F25B0B163B031200ABE73D /* forest.h */, + 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */, + 834D9D571656D7C400E7FAB9 /* regularizedrandomforest.h */, + 834D9D5A1656DEC700E7FAB9 /* regularizeddecisiontree.cpp */, + 834D9D5B1656DEC700E7FAB9 /* regularizeddecisiontree.h */, ); name = randomforest; sourceTree = ""; @@ -2286,6 +2296,8 @@ A721AB72161C572A009860A1 /* kmertree.cpp in Sources */, A721AB77161C573B009860A1 /* taxonomynode.cpp in Sources */, 83F25B0C163B031200ABE73D /* forest.cpp in Sources */, + 834D9D581656D7C400E7FAB9 /* regularizedrandomforest.cpp in Sources */, + 834D9D5C1656DEC800E7FAB9 /* regularizeddecisiontree.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/regularizeddecisiontree.cpp b/regularizeddecisiontree.cpp new file mode 100644 index 0000000..e95848a --- /dev/null +++ b/regularizeddecisiontree.cpp @@ -0,0 +1,9 @@ +// +// regularizeddecisiontree.cpp +// Mothur +// +// Created by Kathryn Iverson on 11/16/12. +// Copyright (c) 2012 Schloss Lab. All rights reserved. +// + +#include "regularizeddecisiontree.h" diff --git a/regularizeddecisiontree.h b/regularizeddecisiontree.h new file mode 100644 index 0000000..47bb4c4 --- /dev/null +++ b/regularizeddecisiontree.h @@ -0,0 +1,16 @@ +// +// regularizeddecisiontree.h +// Mothur +// +// Created by Kathryn Iverson on 11/16/12. +// Copyright (c) 2012 Schloss Lab. All rights reserved. +// + +#ifndef __Mothur__regularizeddecisiontree__ +#define __Mothur__regularizeddecisiontree__ + +#include +#include "rftreenode.hpp" +#include "abstractdecisiontree.hpp" + +#endif /* defined(__Mothur__regularizeddecisiontree__) */ diff --git a/regularizedrandomforest.cpp b/regularizedrandomforest.cpp new file mode 100644 index 0000000..55a8dc4 --- /dev/null +++ b/regularizedrandomforest.cpp @@ -0,0 +1,57 @@ +// +// regularizedrandomforest.cpp +// Mothur +// +// Created by Kathryn Iverson on 11/16/12. +// Copyright (c) 2012 Schloss Lab. All rights reserved. +// + +#include "regularizedrandomforest.h" + +RegularizedRandomForest::RegularizedRandomForest(const vector > dataSet,const int numDecisionTrees, + const string treeSplitCriterion = "informationGain") : Forest(dataSet, numDecisionTrees, treeSplitCriterion) { + m = MothurOut::getInstance(); +} + +int RegularizedRandomForest::calcForrestErrorRate() { + // + try { + return 0; + } + catch(exception& e) { + m->errorOut(e, "RegularizedRandomForest", "calcForrestErrorRate"); + exit(1); + } +} + +int RegularizedRandomForest::calcForrestVariableImportance(string filename) { + // + try { + return 0; + } + catch(exception& e) { + m->errorOut(e, "RegularizedRandomForest", "calcForrestVariableImportance"); + exit(1); + } +} + +int RegularizedRandomForest::populateDecisionTrees() { + // + try { + return 0; + } + catch(exception& e) { + m->errorOut(e, "RegularizedRandomForest", "populateDecisionTrees"); + exit(1); + } +} + +int RegularizedRandomForest::updateGlobalOutOfBagEstimates(DecisionTree *decisionTree) { + try { + return 0; + } + catch(exception& e) { + m->errorOut(e, "RegularizedRandomForest", "updateGlobalOutOfBagEstimates"); + exit(1); + } +} \ No newline at end of file diff --git a/regularizedrandomforest.h b/regularizedrandomforest.h new file mode 100644 index 0000000..94bd624 --- /dev/null +++ b/regularizedrandomforest.h @@ -0,0 +1,30 @@ +// +// regularizedrandomforest.h +// Mothur +// +// Created by Kathryn Iverson on 11/16/12. +// Copyright (c) 2012 Schloss Lab. All rights reserved. +// + +#ifndef __Mothur__regularizedrandomforest__ +#define __Mothur__regularizedrandomforest__ + +#include "forest.h" +#include "decisiontree.hpp" + +class RegularizedRandomForest: public Forest { +public: + // + RegularizedRandomForest(const vector > dataSet,const int numDecisionTrees, const string); + + int calcForrestErrorRate(); + int calcForrestVariableImportance(string); + int populateDecisionTrees(); + int updateGlobalOutOfBagEstimates(DecisionTree* decisionTree); + +private: + // + MothurOut* m; +}; + +#endif /* defined(__Mothur__regularizedrandomforest__) */ -- 2.39.2