You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: myst_nbs/case_studies/probabilistic_matrix_factorization.myst.md
+13-5Lines changed: 13 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -15,11 +15,17 @@ kernelspec:
15
15
# Probabilistic Matrix Factorization for Making Personalized Recommendations
16
16
17
17
:::{post} June 3, 2022
18
-
:tags: case study
18
+
:tags: case study, product recommendation, matrix factorization
19
19
:category: intermediate
20
+
:author: Ruslan Salakhutdinov, Andriy Mnih, Mack Sweeney, Colin Carroll, Rob Zinkov
20
21
:::
21
22
22
23
```{code-cell} ipython3
24
+
%load_ext autoreload
25
+
```
26
+
27
+
```{code-cell} ipython3
28
+
%autoreload 2
23
29
%matplotlib inline
24
30
25
31
import arviz as az
@@ -361,14 +367,14 @@ class PMF:
361
367
mu=0,
362
368
tau=self.alpha_u * np.eye(dim),
363
369
dims=("users", "latent_factors"),
364
-
testval=rng.standard_normal(size=(n, dim)) * std,
370
+
initval=rng.standard_normal(size=(n, dim)) * std,
365
371
)
366
372
V = pm.MvNormal(
367
373
"V",
368
374
mu=0,
369
375
tau=self.alpha_v * np.eye(dim),
370
376
dims=("movies", "latent_factors"),
371
-
testval=rng.standard_normal(size=(m, dim)) * std,
377
+
initval=rng.standard_normal(size=(m, dim)) * std,
372
378
)
373
379
R = pm.Normal(
374
380
"R",
@@ -397,7 +403,7 @@ Since it is a reasonably complex model, we expect the MAP estimation to take som
397
403
def _find_map(self):
398
404
"""Find mode of posterior using L-BFGS-B optimization."""
399
405
tstart = time.time()
400
-
with self.model:
406
+
with self.model as m:
401
407
logging.info("finding PMF MAP using L-BFGS-B optimization...")
402
408
self._map = pm.find_MAP(method="L-BFGS-B")
403
409
@@ -757,6 +763,8 @@ If you made it this far, then congratulations! You now have some idea of how to
757
763
758
764
+++
759
765
766
+
## Authors
767
+
760
768
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.
0 commit comments