Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update outdated codes in cf.md and datasetmapper.md #3398

Merged
merged 9 commits into from
Feb 11, 2023
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
### mlpack ?.?.?
###### ????-??-??

* Update outdated codes in cf.md and datasetmapper.md (#3398).
AdarshSantoria marked this conversation as resolved.
Show resolved Hide resolved

* Bugfix for non-square convolution kernels (#3376).

* Fix a few missing includes in `<mlpack.hpp>` (#3374).
Expand Down
23 changes: 13 additions & 10 deletions doc/tutorials/cf.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
CF cf(data, NMFPolicy(), neighborhood, rank);

// Store the results in this object.
arma::Mat<size_t> recommendations;
Expand All @@ -270,12 +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`
- `BatchSVDPolicy`
- `SVDCompletePolicy`
- `SVDIncompletePolicy`
- `NMFPolicy`
- `RegSVDPolicy`
- `QuicSVDPolicy`
- `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
Expand All @@ -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<size_t> recommendations;
Expand Down Expand Up @@ -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);
CF cf(data, NMFPolicy(), neighborhood, rank);

const double prediction = cf.Predict(12, 50); // User 12, item 50.
```
Expand All @@ -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);
CF cf(data, NMFPolicy(), neighborhood, rank);

// References to W and H matrices.
const arma::mat& W = cf.W();
Expand Down
10 changes: 5 additions & 5 deletions doc/tutorials/datasetmapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function.
using namespace mlpack;

arma::mat data;
data::DatasetMapper info;
data::DatasetInfo info;
data::Load("dataset.csv", data, info);
```

Expand Down Expand Up @@ -155,8 +155,8 @@ std::cout << info.UnmapString(1, 2) << "\n";
This will print:

```
T
F
True
False
```

### `UnmapValue()`
Expand All @@ -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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, nice catch on this one. 👍

```

will produce:
Expand Down
2 changes: 2 additions & 0 deletions src/mlpack/methods/cf/cf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ class CFType
};
}; // class CFType

typedef CFType<> CF;

} // namespace mlpack

// Include implementation of templated functions.
Expand Down