13 template <
class NMFTYPE>
15 std::string WfileName, std::string HfileName,
int numIt) {
22 if (!AfileName.empty() &&
23 !AfileName.compare(AfileName.size() - 4, 4,
"rand")) {
25 A.load(AfileName, arma::coord_ascii);
26 INFO <<
"Successfully loaded the input matrix" << std::endl;
32 <<
" took=" << t2 << std::endl;
38 A = arma::sprandu<SP_MAT>(m, n, 0.001);
40 A = arma::randu<MAT>(m, n);
45 NMFTYPE nmfAlgorithm(A, k);
46 nmfAlgorithm.num_iterations(numIt);
49 nmfAlgorithm.computeNMF();
51 INFO <<
"time taken:" << t2 << std::endl;
52 if (WfileName.compare(
"_w") != 0) {
53 nmfAlgorithm.getLeftLowRankFactor().save(WfileName, arma::raw_ascii);
55 if (HfileName.compare(
"_h") != 0) {
56 nmfAlgorithm.getRightLowRankFactor().save(HfileName, arma::raw_ascii);
60 void incrementalGraph(std::string AfileName, std::string WfileName) {
67 H.ones(A.n_cols, W.n_cols);
69 H = bppnmf.solveScalableNNLS();
80 NMFDriver<planc::MUNMF<SP_MAT> >(
85 NMFDriver<planc::MUNMF<MAT> >(
93 NMFDriver<planc::HALSNMF<SP_MAT> >(
98 NMFDriver<planc::HALSNMF<MAT> >(
106 NMFDriver<planc::BPPNMF<SP_MAT> >(
111 NMFDriver<planc::BPPNMF<MAT> >(
122 NMFDriver<planc::AOADMMNMF<SP_MAT> >(
128 NMFDriver<planc::AOADMMNMF<MAT> >(
135 ERR <<
"Not a valid algorithm" << std::endl;
algotype lucalgo()
Returns the NMF algorithm to run. Passed as parameter –algo or -a.
void NMFDriver(int k, UWORD m, UWORD n, std::string AfileName, std::string WfileName, std::string HfileName, int numIt)
int main(int argc, char *argv[])
std::string output_file_name()
Returns output file name.
void tic()
start the timer. easy to call as tic(); some code; double t=toc();
int iterations()
Returns number of iterations. passed as -t or –iter.
void parseplancopts()
parses the command line parameters
UWORD lowrankk()
returns the low rank. Passed as parameter –lowrank or -k
void parseCommandLineandCallNMF(int argc, char *argv[])
UWORD globalm()
return global rows. Passed as parameter -d
std::string input_file_name()
Returns input file name. Passed as -i or –input.
void printConfig()
print the configuration received through the command line paramters