From 1744769970b633b613030a694dfe9a74785a3801 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 15 Apr 2024 16:04:23 -0400 Subject: [PATCH 1/4] Fix AdaBoost table. --- doc/user/methods/adaboost.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/user/methods/adaboost.md b/doc/user/methods/adaboost.md index 18357587fd..a4371f40fc 100644 --- a/doc/user/methods/adaboost.md +++ b/doc/user/methods/adaboost.md @@ -86,9 +86,7 @@ std::cout << arma::accu(predictions == 3) << " test points classified as class " | `data` | [`arma::mat`](../matrices.md) | [Column-major](../matrices.md#representing-data-in-mlpack) training matrix. | _(N/A)_ | | `labels` | [`arma::Row`](../matrices.md) | Training labels, [between `0` and `numClasses - 1`](../load_save.md#normalizing-labels) (inclusive). Should have length `data.n_cols`. | _(N/A)_ | | `numClasses` | `size_t` | Number of classes in the dataset. | _(N/A)_ | -| `weakLearner` | `Perceptron` | An initialized weak learner whose -hyperparameters will be used as settings for weak learners during training. | -_(N/A)_ | +| `weakLearner` | `Perceptron` | An initialized weak learner whose hyperparameters will be used as settings for weak learners during training. | _(N/A)_ | | `maxIterations` | `size_t` | Maximum number of iterations of AdaBoost.MH to use. This is the maximum number of weak learners to train. (0 means no limit, and weak learners will be trained until the tolerance is met.) | `100` | | `tolerance` | `double` | When the weighted residual (`r_t`) of the model goes below `tolerance`, training will terminate and no more weak learners will be added. | `1e-6` | From 86ccccc1f98e556a9565f9ce539107981a2b2d89 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 17 Apr 2024 16:40:22 -0400 Subject: [PATCH 2/4] Handle verbose directly inside the binding function so we access the correct Log::Info. --- src/mlpack/bindings/R/print_R.cpp | 15 ++------------- src/mlpack/bindings/R/r_method.cpp.in | 5 +++++ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/mlpack/bindings/R/print_R.cpp b/src/mlpack/bindings/R/print_R.cpp index 97615bf58c..259766427a 100644 --- a/src/mlpack/bindings/R/print_R.cpp +++ b/src/mlpack/bindings/R/print_R.cpp @@ -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) diff --git a/src/mlpack/bindings/R/r_method.cpp.in b/src/mlpack/bindings/R/r_method.cpp.in index 68e1928da9..3452ecfab4 100644 --- a/src/mlpack/bindings/R/r_method.cpp.in +++ b/src/mlpack/bindings/R/r_method.cpp.in @@ -17,6 +17,11 @@ void ${PROGRAM_NAME}_call(SEXP params, SEXP timers) util::Params& p = *Rcpp::as>(params); util::Timers& t = *Rcpp::as>(timers); + if (p.Has("verbose")) + Log::Info.ignoreInput = false; + else + Log::Info.ignoreInput = true; + BINDING_FUNCTION(p, t); } From bce98510e18f8bf73f57fc070e1130e5c5ce0fed Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 17 Apr 2024 16:40:49 -0400 Subject: [PATCH 3/4] Remove now-unneeded macro since we are not using Boost anymore. --- src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h b/src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h index bd9ecf3ef1..83f272e753 100644 --- a/src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h +++ b/src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h @@ -15,9 +15,6 @@ #include -// 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) From a0e06d9d00d01f3a1a5c9a120a73696eeb1cf80a Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 17 Apr 2024 16:48:08 -0400 Subject: [PATCH 4/4] Update HISTORY. --- HISTORY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index f770eab01a..19cc210570 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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).