Skip to content

Commit 6570c57

Browse files
author
Severin Hatt
committed
Re-running case_studies/probabilistic_matrix_factorization, tag update
1 parent 463fdd4 commit 6570c57

File tree

2 files changed

+171
-53
lines changed

2 files changed

+171
-53
lines changed

examples/case_studies/probabilistic_matrix_factorization.ipynb

Lines changed: 158 additions & 48 deletions
Large diffs are not rendered by default.

myst_nbs/case_studies/probabilistic_matrix_factorization.myst.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ kernelspec:
1515
# Probabilistic Matrix Factorization for Making Personalized Recommendations
1616

1717
:::{post} June 3, 2022
18-
:tags: case study
18+
:tags: case study, product recommendation, matrix factorization
1919
:category: intermediate
20+
:author: Ruslan Salakhutdinov, Andriy Mnih, Mack Sweeney, Colin Carroll, Rob Zinkov
2021
:::
2122

2223
```{code-cell} ipython3
24+
%load_ext autoreload
25+
```
26+
27+
```{code-cell} ipython3
28+
%autoreload 2
2329
%matplotlib inline
2430
2531
import arviz as az
@@ -361,14 +367,14 @@ class PMF:
361367
mu=0,
362368
tau=self.alpha_u * np.eye(dim),
363369
dims=("users", "latent_factors"),
364-
testval=rng.standard_normal(size=(n, dim)) * std,
370+
initval=rng.standard_normal(size=(n, dim)) * std,
365371
)
366372
V = pm.MvNormal(
367373
"V",
368374
mu=0,
369375
tau=self.alpha_v * np.eye(dim),
370376
dims=("movies", "latent_factors"),
371-
testval=rng.standard_normal(size=(m, dim)) * std,
377+
initval=rng.standard_normal(size=(m, dim)) * std,
372378
)
373379
R = pm.Normal(
374380
"R",
@@ -397,7 +403,7 @@ Since it is a reasonably complex model, we expect the MAP estimation to take som
397403
def _find_map(self):
398404
"""Find mode of posterior using L-BFGS-B optimization."""
399405
tstart = time.time()
400-
with self.model:
406+
with self.model as m:
401407
logging.info("finding PMF MAP using L-BFGS-B optimization...")
402408
self._map = pm.find_MAP(method="L-BFGS-B")
403409
@@ -757,6 +763,8 @@ If you made it this far, then congratulations! You now have some idea of how to
757763

758764
+++
759765

766+
## Authors
767+
760768
The model discussed in this analysis was developed by Ruslan Salakhutdinov and Andriy Mnih. Code and supporting text are the original work of [Mack Sweeney](https://www.linkedin.com/in/macksweeney) with changes made to adapt the code and text for the MovieLens dataset by Colin Carroll and Rob Zinkov.
761769

762770
+++
@@ -775,7 +783,7 @@ goldberg2001eigentaste
775783

776784
```{code-cell} ipython3
777785
%load_ext watermark
778-
%watermark -n -u -v -iv -w
786+
%watermark -n -u -v -iv -w -p aesara,aeppl,xarray
779787
```
780788

781789
:::{include} ../page_footer.md

0 commit comments

Comments
 (0)