Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,24 +20,34 @@ PROGRAM_INFO("GMM Probability Calculator", | |
|
||
PARAM_STRING_REQ("input_model_file", "File containing input GMM.", "m"); | ||
PARAM_STRING_REQ("input_file", "File containing points.", "i"); | ||
PARAM_STRING_REQ("output_file", "File to save calculated probabilities to.", "o"); | ||
|
||
PARAM_STRING("output_file", "File to save calculated probabilities to.", "o", ""); | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
CLI::ParseCommandLine(argc, argv); | ||
|
||
const string inputFile = CLI::GetParam<string>("input_file"); | ||
const string inputModelFile = CLI::GetParam<string>("input_model_file"); | ||
const string outputFile = CLI::GetParam<string>("input_model_file"); | ||
This comment has been minimized.
Sorry, something went wrong.
sergiud
|
||
|
||
if (CLI::HasParam("output_file")) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
Log::Warn << "--output_file (-o) is not specified;" | ||
<< "no results will be saved!" << endl; | ||
|
||
// Get the GMM and the points. | ||
GMM gmm; | ||
data::Load(CLI::GetParam<string>("input_model_file"), "gmm", gmm); | ||
data::Load(inputFile, "gmm", gmm); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
arma::mat dataset; | ||
data::Load(CLI::GetParam<string>("input_file"), dataset); | ||
data::Load(inputModelFile, dataset); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
// Now calculate the probabilities. | ||
arma::rowvec probabilities(dataset.n_cols); | ||
for (size_t i = 0; i < dataset.n_cols; ++i) | ||
probabilities[i] = gmm.Probability(dataset.unsafe_col(i)); | ||
|
||
// And save the result. | ||
data::Save(CLI::GetParam<string>("output_file"), probabilities); | ||
if (CLI::HasParam("output_file")) | ||
data::Save(outputFile, probabilities); | ||
} |
1 comment
on commit d79dd3f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow sorry for the huge mistakes I've made :(
And thanks for pointing those out.
I failed to check the output when I mindlessly changed variable.empty()
to CLI::HasParam("variable")
This statement must be inverted.