Merge pull request #3691 from rcurtin/r-binding-verbose

Fix `verbose` for R bindings
This commit is contained in:
James J Balamuta
2024-04-17 22:27:21 -07:00
committed by GitHub
4 changed files with 9 additions and 16 deletions
+2
View File
@@ -37,6 +37,8 @@
* Allow PCA to take different matrix types (#3677).
* Fix non-working `verbose` option for R bindings (#3691).
### mlpack 4.3.0
###### 2023-11-27
* Fix include ordering issue for `LinearRegression` (#3541).
@@ -15,9 +15,6 @@
#include <Rcpp.h>
// To suppress Found '__assert_fail', possibly from 'assert' (C).
#define BOOST_DISABLE_ASSERTS
// Rcpp has its own stream object which cooperates more nicely with R's i/o
// And as of armadillo and mlpack, we can use this stream object as well.
#if !defined(ARMA_COUT_STREAM)
+2 -13
View File
@@ -184,21 +184,10 @@ void PrintR(util::Params& params,
<< endl;
for (const string& opt : inputOptions)
{
if (opt != "verbose")
{
util::ParamData& d = parameters.at(opt);
params.functionMap[d.tname]["PrintInputProcessing"](d, NULL, NULL);
}
util::ParamData& d = parameters.at(opt);
params.functionMap[d.tname]["PrintInputProcessing"](d, NULL, NULL);
}
// Special handling for verbose output.
cout << " if (verbose) {" << endl;
cout << " EnableVerbose()" << endl;
cout << " } else {" << endl;
cout << " DisableVerbose()" << endl;
cout << " }" << endl;
cout << endl;
// Mark output parameters as passed.
cout << " # Mark all output options as passed." << endl;
for (const string& opt : outputOptions)
+5
View File
@@ -17,6 +17,11 @@ void ${PROGRAM_NAME}_call(SEXP params, SEXP timers)
util::Params& p = *Rcpp::as<Rcpp::XPtr<util::Params>>(params);
util::Timers& t = *Rcpp::as<Rcpp::XPtr<util::Timers>>(timers);
if (p.Has("verbose"))
Log::Info.ignoreInput = false;
else
Log::Info.ignoreInput = true;
BINDING_FUNCTION(p, t);
}