X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=qFinderDMM.h;fp=qFinderDMM.h;h=d94e6cce9f11b89de87d9f756ae490c69aabda72;hb=4a760c2d164aa955dee7d3d38da323822763d906;hp=0000000000000000000000000000000000000000;hpb=feb0fbef36b8a681efc04e9b5e3efb1647b99021;p=mothur.git diff --git a/qFinderDMM.h b/qFinderDMM.h new file mode 100644 index 0000000..d94e6cc --- /dev/null +++ b/qFinderDMM.h @@ -0,0 +1,69 @@ +// +// qFinderDMM.h +// pds_dmm +// +// Created by Patrick Schloss on 11/8/12. +// Copyright (c) 2012 University of Michigan. All rights reserved. +// + +#ifndef pds_dmm_qFinderDMM_h +#define pds_dmm_qFinderDMM_h + +/**************************************************************************************************/ + +#include "mothurout.h" + +/**************************************************************************************************/ + +class qFinderDMM { + +public: + qFinderDMM(vector >, int); + double getNLL() { return currNLL; } + double getAIC() { return aic; } + double getBIC() { return bic; } + double getLogDet() { return logDeterminant; } + double getLaplace() { return laplace; } + void printZMatrix(string, vector); + void printRelAbund(string, vector); + +private: + MothurOut* m; + void kMeans(); + void optimizeLambda(); + void calculatePiK(); + + double negativeLogEvidenceLambdaPi(vector&); + void negativeLogDerivEvidenceLambdaPi(vector&, vector&); + double getNegativeLogEvidence(vector&, int); + double getNegativeLogLikelihood(); + vector > getHessian(); + + int lineMinimizeFletcher(vector&, vector&, double, double, double, double&, double&, vector&, vector&); + int bfgs2_Solver(vector&);//, double, double); + double cheb_eval(const double[], int, double); + double psi(double); + double psi1(double); + + vector > countMatrix; + vector > zMatrix; + vector > lambdaMatrix; + vector weights; + vector > error; + + int numPartitions; + int numSamples; + int numOTUs; + int currentPartition; + + double currNLL; + double aic; + double bic; + double logDeterminant; + double laplace; + +}; + +/**************************************************************************************************/ + +#endif