From 5687d8a9746c73f9a4ad61aa15852c183be981d8 Mon Sep 17 00:00:00 2001 From: Adarsh Santoria <108261986+AdarshSantoria@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:46:47 +0530 Subject: [PATCH 1/9] Update codes and improve cf doc --- doc/tutorials/cf.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/tutorials/cf.md b/doc/tutorials/cf.md index 9452ebfdd0..2efb086e9d 100644 --- a/doc/tutorials/cf.md +++ b/doc/tutorials/cf.md @@ -255,7 +255,7 @@ extern size_t rank; // Build the CF object and perform the decomposition. // The constructor takes a default-constructed factorizer, which, by default, // is of type NMFALSFactorizer. -CF cf(data, NMFALSFactorizer(), neighborhood, rank); +CFType cf(data, NMFPolicy(), neighborhood, rank); // Store the results in this object. arma::Mat recommendations; @@ -276,6 +276,9 @@ alternating least squares update rules). These include: - `NMFALSFactorizer` - `RegularizedSVD` - `QUIC_SVD` + - `BiasSVD` + - `SVDPlusPlus` + - `RandomizedSVD` The `AMF` class has many other possibilities than those listed here; it is a framework for alternating matrix factorization techniques. See the `AMF` class @@ -297,7 +300,7 @@ extern size_t neighborhood; extern size_t rank; // Build the CF object and perform the decomposition. -CF cf(data, RegularizedSVD(), neighborhood, rank); +CFType cf(data, RegSVDPolicy(), neighborhood, rank); // Store the results in this object. arma::Mat recommendations; @@ -330,7 +333,7 @@ extern size_t rank; // Build the CF object and perform the decomposition. // The constructor takes a default-constructed factorizer, which, by default, // is of type NMFALSFactorizer. -CF cf(data, NMFALSFactorizer(), neighborhood, rank); +CFType cf(data, NMFPolicy(), neighborhood, rank); const double prediction = cf.Predict(12, 50); // User 12, item 50. ``` @@ -356,7 +359,7 @@ extern size_t rank; // Build the CF object and perform the decomposition. // The constructor takes a default-constructed factorizer, which, by default, // is of type NMFALSFactorizer. -CF cf(data, NMFALSFactorizer(), neighborhood, rank); +CFType cf(data, NMFPolicy(), neighborhood, rank); // References to W and H matrices. const arma::mat& W = cf.W(); From 0b9b1d483f1c0caf8c01f4ed0929933391e924e6 Mon Sep 17 00:00:00 2001 From: Adarsh Santoria <108261986+AdarshSantoria@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:52:47 +0530 Subject: [PATCH 2/9] Update codes in datasetmapper.md --- doc/tutorials/datasetmapper.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/tutorials/datasetmapper.md b/doc/tutorials/datasetmapper.md index a841071216..a94854568a 100644 --- a/doc/tutorials/datasetmapper.md +++ b/doc/tutorials/datasetmapper.md @@ -43,7 +43,7 @@ function. using namespace mlpack; arma::mat data; -data::DatasetMapper info; +data::DatasetInfo info; data::Load("dataset.csv", data, info); ``` @@ -155,8 +155,8 @@ std::cout << info.UnmapString(1, 2) << "\n"; This will print: ``` -T -F +True +False ``` ### `UnmapValue()` @@ -168,8 +168,8 @@ The `UnmapValue()` function has the signature `UnmapValue(const std::string - `dimension` is the dimension in which you want to find the mapped value ```c++ -std::cout << info.UnmapValue("T", 2) << "\n"; -std::cout << info.UnmapValue("F", 2) << "\n"; +std::cout << info.UnmapValue("True", 2) << "\n"; +std::cout << info.UnmapValue("False", 2) << "\n"; ``` will produce: From 2a3f3e69d1051d47743e8972f27e22903a5a40de Mon Sep 17 00:00:00 2001 From: Adarsh Santoria <108261986+AdarshSantoria@users.noreply.github.com> Date: Tue, 7 Feb 2023 19:12:27 +0530 Subject: [PATCH 3/9] CFType to CF Change inorder to make CF typedef from CFType --- doc/tutorials/cf.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/tutorials/cf.md b/doc/tutorials/cf.md index 2efb086e9d..397f5708da 100644 --- a/doc/tutorials/cf.md +++ b/doc/tutorials/cf.md @@ -255,7 +255,7 @@ extern size_t rank; // Build the CF object and perform the decomposition. // The constructor takes a default-constructed factorizer, which, by default, // is of type NMFALSFactorizer. -CFType cf(data, NMFPolicy(), neighborhood, rank); +CF cf(data, NMFPolicy(), neighborhood, rank); // Store the results in this object. arma::Mat recommendations; @@ -300,7 +300,7 @@ extern size_t neighborhood; extern size_t rank; // Build the CF object and perform the decomposition. -CFType cf(data, RegSVDPolicy(), neighborhood, rank); +CF cf(data, RegSVDPolicy(), neighborhood, rank); // Store the results in this object. arma::Mat recommendations; @@ -333,7 +333,7 @@ extern size_t rank; // Build the CF object and perform the decomposition. // The constructor takes a default-constructed factorizer, which, by default, // is of type NMFALSFactorizer. -CFType cf(data, NMFPolicy(), neighborhood, rank); +CF cf(data, NMFPolicy(), neighborhood, rank); const double prediction = cf.Predict(12, 50); // User 12, item 50. ``` @@ -359,7 +359,7 @@ extern size_t rank; // Build the CF object and perform the decomposition. // The constructor takes a default-constructed factorizer, which, by default, // is of type NMFALSFactorizer. -CFType cf(data, NMFPolicy(), neighborhood, rank); +CF cf(data, NMFPolicy(), neighborhood, rank); // References to W and H matrices. const arma::mat& W = cf.W(); From 50c797a9b1151f025b1850ef54c29ea47ce75005 Mon Sep 17 00:00:00 2001 From: Adarsh Santoria <108261986+AdarshSantoria@users.noreply.github.com> Date: Tue, 7 Feb 2023 19:29:32 +0530 Subject: [PATCH 4/9] typedef CF to CFType --- src/mlpack/methods/cf/cf.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mlpack/methods/cf/cf.hpp b/src/mlpack/methods/cf/cf.hpp index 90bcb80338..6efb558d12 100644 --- a/src/mlpack/methods/cf/cf.hpp +++ b/src/mlpack/methods/cf/cf.hpp @@ -283,6 +283,8 @@ class CFType }; }; // class CFType +typedef CFType<> CF; + } // namespace mlpack // Include implementation of templated functions. From 58df0e6908cef80931dca3a3aa4a20afaa39cd05 Mon Sep 17 00:00:00 2001 From: Adarsh Santoria <108261986+AdarshSantoria@users.noreply.github.com> Date: Thu, 9 Feb 2023 14:05:11 +0530 Subject: [PATCH 5/9] default set only for NMFPolicy --- doc/tutorials/cf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tutorials/cf.md b/doc/tutorials/cf.md index 397f5708da..8a932d0df5 100644 --- a/doc/tutorials/cf.md +++ b/doc/tutorials/cf.md @@ -300,7 +300,7 @@ extern size_t neighborhood; extern size_t rank; // Build the CF object and perform the decomposition. -CF cf(data, RegSVDPolicy(), neighborhood, rank); +CFType cf(data, RegSVDPolicy(), neighborhood, rank); // Store the results in this object. arma::Mat recommendations; From 7a6c51615b2c6ed041ddc0a48e5e27eca4d75c99 Mon Sep 17 00:00:00 2001 From: Adarsh Santoria <108261986+AdarshSantoria@users.noreply.github.com> Date: Fri, 10 Feb 2023 01:30:52 +0530 Subject: [PATCH 6/9] Change factorizers names to what's used in code --- doc/tutorials/cf.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/tutorials/cf.md b/doc/tutorials/cf.md index 8a932d0df5..8cb821c7cd 100644 --- a/doc/tutorials/cf.md +++ b/doc/tutorials/cf.md @@ -270,15 +270,15 @@ mlpack provides a number of existing factorizers which can be used in place of the default `NMFALSFactorizer` (which is non-negative matrix factorization with alternating least squares update rules). These include: - - `SVDBatchFactorizer` - - `SVDCompleteIncrementalFactorizer` - - `SVDIncompleteIncrementalFactorizer` - - `NMFALSFactorizer` - - `RegularizedSVD` - - `QUIC_SVD` - - `BiasSVD` - - `SVDPlusPlus` - - `RandomizedSVD` + - `BatchSVDPolicy` + - `SVDCompletePolicy` + - `SVDIncompletePolicy` + - `NMFPolicy` + - `RegSVDPolicy` + - `QUIC_SVDPolicy` + - `BiasSVDPolicy` + - `SVDPlusPlusPolicy` + - `RandomizedSVDPolicy` The `AMF` class has many other possibilities than those listed here; it is a framework for alternating matrix factorization techniques. See the `AMF` class From c26e762a57ce300079ad548eba0872406292fd8d Mon Sep 17 00:00:00 2001 From: Adarsh Santoria <108261986+AdarshSantoria@users.noreply.github.com> Date: Fri, 10 Feb 2023 01:33:08 +0530 Subject: [PATCH 7/9] Change factorizers names to it's corresponding --- doc/tutorials/cf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tutorials/cf.md b/doc/tutorials/cf.md index 8cb821c7cd..aa3c4fb57e 100644 --- a/doc/tutorials/cf.md +++ b/doc/tutorials/cf.md @@ -275,7 +275,7 @@ alternating least squares update rules). These include: - `SVDIncompletePolicy` - `NMFPolicy` - `RegSVDPolicy` - - `QUIC_SVDPolicy` + - `QuicSVDPolicy` - `BiasSVDPolicy` - `SVDPlusPlusPolicy` - `RandomizedSVDPolicy` From fcab7355f6d1e154784f89e2a62595a97b69635e Mon Sep 17 00:00:00 2001 From: Adarsh Santoria <108261986+AdarshSantoria@users.noreply.github.com> Date: Fri, 10 Feb 2023 21:09:27 +0530 Subject: [PATCH 8/9] Update HISTORY.md --- HISTORY.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index 5abe54ee22..f7d8b9fd17 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,8 @@ ### mlpack ?.?.? ###### ????-??-?? + + * Update outdated codes in cf.md and datasetmapper.md (#3398). + * Bugfix for non-square convolution kernels (#3376). * Fix a few missing includes in `` (#3374). From e0c7866dd34fe8fdb719e966de8a40ae18e4ea7b Mon Sep 17 00:00:00 2001 From: Adarsh Santoria <108261986+AdarshSantoria@users.noreply.github.com> Date: Sat, 11 Feb 2023 22:31:11 +0530 Subject: [PATCH 9/9] Update HISTORY.md Co-authored-by: Ryan Curtin --- HISTORY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index f7d8b9fd17..aa5162ad1e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,7 +1,7 @@ ### mlpack ?.?.? ###### ????-??-?? - * Update outdated codes in cf.md and datasetmapper.md (#3398). + * Update outdated code in tutorials (#3398). * Bugfix for non-square convolution kernels (#3376).