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 */; };
7E6BE10812F710D8007ADDBE /* refchimeratest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = refchimeratest.h; sourceTree = "<group>"; };
7E6BE10912F710D8007ADDBE /* refchimeratest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = refchimeratest.cpp; sourceTree = "<group>"; };
7E78911B135F3E8600E725D2 /* eachgapdistignorens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eachgapdistignorens.h; sourceTree = "<group>"; };
+ 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = regularizedrandomforest.cpp; sourceTree = "<group>"; };
+ 834D9D571656D7C400E7FAB9 /* regularizedrandomforest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regularizedrandomforest.h; sourceTree = "<group>"; };
+ 834D9D5A1656DEC700E7FAB9 /* regularizeddecisiontree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = regularizeddecisiontree.cpp; sourceTree = "<group>"; };
+ 834D9D5B1656DEC700E7FAB9 /* regularizeddecisiontree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = regularizeddecisiontree.h; sourceTree = "<group>"; };
83F25B0A163B031200ABE73D /* forest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = forest.cpp; sourceTree = "<group>"; };
83F25B0B163B031200ABE73D /* forest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = forest.h; sourceTree = "<group>"; };
8DD76FB20486AB0100D96B5E /* mothur */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mothur; sourceTree = BUILT_PRODUCTS_DIR; };
A77E193A161B289600DB1A2A /* rftreenode.cpp */,
83F25B0A163B031200ABE73D /* forest.cpp */,
83F25B0B163B031200ABE73D /* forest.h */,
+ 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */,
+ 834D9D571656D7C400E7FAB9 /* regularizedrandomforest.h */,
+ 834D9D5A1656DEC700E7FAB9 /* regularizeddecisiontree.cpp */,
+ 834D9D5B1656DEC700E7FAB9 /* regularizeddecisiontree.h */,
);
name = randomforest;
sourceTree = "<group>";
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;
};
m->openOutputFile(outputFileName, out);
outputNames.push_back(outputFileName); outputTypes["summary"].push_back(outputFileName);
out.setf(ios::fixed, ios::floatfield); out.setf(ios::showpoint);
- out << "metric\tlabel\tScore\tzScore\tstandardDeviation\n";
+ out << "metric\tlabel\tScore\tzScore\tstandardDeviation\tnp_Pvalue\n";
//as long as you are not at the end of the file or done wih the lines you want
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
m->mothurOut("zscore: " + toString(zscore)); m->mothurOutEndLine();
m->mothurOut("standard deviation: " + toString(sd)); m->mothurOutEndLine();
- out << metric << '\t' << thisLookUp[0]->getLabel() << '\t' << nullMean << '\t' << zscore << '\t' << sd << endl;
+ m->mothurOut("non-parametric p-value: " + toString(pvalue)); m->mothurOutEndLine();
+ out << metric << '\t' << thisLookUp[0]->getLabel() << '\t' << nullMean << '\t' << zscore << '\t' << sd << '\t' << pvalue << endl;
return 0;
}
numDecisionTrees(numDecisionTrees),
numSamples((int)dataSet.size()),
numFeatures((int)(dataSet[0].size() - 1)),
-globalDiscardedFeatureIndices(getGlobalDiscardedFeatureIndices()),
globalVariableImportanceList(numFeatures, 0),
treeSplitCriterion(treeSplitCriterion) {
m = MothurOut::getInstance();
+ globalDiscardedFeatureIndices = getGlobalDiscardedFeatureIndices();
// TODO: double check if the implemenatation of 'globalOutOfBagEstimates' is correct
}
--- /dev/null
+//
+// regularizeddecisiontree.cpp
+// Mothur
+//
+// Created by Kathryn Iverson on 11/16/12.
+// Copyright (c) 2012 Schloss Lab. All rights reserved.
+//
+
+#include "regularizeddecisiontree.h"
--- /dev/null
+//
+// 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 <iostream>
+#include "rftreenode.hpp"
+#include "abstractdecisiontree.hpp"
+
+#endif /* defined(__Mothur__regularizeddecisiontree__) */
--- /dev/null
+//
+// 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 <vector<int> > 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
--- /dev/null
+//
+// 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 <vector<int> > dataSet,const int numDecisionTrees, const string);
+
+ int calcForrestErrorRate();
+ int calcForrestVariableImportance(string);
+ int populateDecisionTrees();
+ int updateGlobalOutOfBagEstimates(DecisionTree* decisionTree);
+
+private:
+ //
+ MothurOut* m;
+};
+
+#endif /* defined(__Mothur__regularizedrandomforest__) */
}
}
- cscore = cscore/(double)(nrows*(nrows-1)/2);
+ //cscore = cscore/(double)(nrows*(nrows-1)/2); //not normalized
//cout << "normalized c score: " << normcscore/nonzeros << endl;
-
+ cscore = normcscore/(double)nonzeros;
+
return cscore;
}
catch(exception& e) {