Skip to content

Commit 1bf82ef

Browse files
authored
Math not rendering in docs (#3712)
1 parent bbf7137 commit 1bf82ef

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/source/notebooks/probabilistic_matrix_factorization.ipynb

+10-10
Original file line numberDiff line numberDiff line change
@@ -742,21 +742,21 @@
742742
"\n",
743743
"$\\newcommand\\given[1][]{\\:#1\\vert\\:}$\n",
744744
"\n",
745-
"\\begin{equation}\n",
745+
"$$\n",
746746
"P(R \\given U, V, \\alpha^2) = \n",
747747
" \\prod_{i=1}^N \\prod_{j=1}^M\n",
748748
" \\left[ \\mathcal{N}(R_{ij} \\given U_i V_j^T, \\alpha^{-1}) \\right]^{I_{ij}}\n",
749-
"\\end{equation}\n",
749+
"$$\n",
750750
"\n",
751-
"\\begin{equation}\n",
751+
"$$\n",
752752
"P(U \\given \\alpha_U^2) =\n",
753753
" \\prod_{i=1}^N \\mathcal{N}(U_i \\given 0, \\alpha_U^{-1} \\boldsymbol{I})\n",
754-
"\\end{equation}\n",
754+
"$$\n",
755755
"\n",
756-
"\\begin{equation}\n",
756+
"$$\n",
757757
"P(V \\given \\alpha_U^2) =\n",
758758
" \\prod_{j=1}^M \\mathcal{N}(V_j \\given 0, \\alpha_V^{-1} \\boldsymbol{I})\n",
759-
"\\end{equation}\n",
759+
"$$\n",
760760
"\n",
761761
"Given small precision parameters, the priors on $U$ and $V$ ensure our latent variables do not grow too far from 0. This prevents overly strong user preferences and item factor compositions from being learned. This is commonly known as complexity control, where the complexity of the model here is measured by the magnitude of the latent variables. Controlling complexity like this helps prevent overfitting, which allows the model to generalize better for unseen data. We must also choose an appropriate $\\alpha$ value for the normal distribution for $R$. So the challenge becomes choosing appropriate values for $\\alpha_U$, $\\alpha_V$, and $\\alpha$. This challenge can be tackled with the soft weight-sharing methods discussed by [Nowland and Hinton, 1992](http://www.cs.toronto.edu/~fritz/absps/sunspots.pdf) [4]. However, for the purposes of this analysis, we will stick to using point estimates obtained from our data."
762762
]
@@ -902,10 +902,10 @@
902902
"source": [
903903
"We could define some kind of default trace property like we did for the MAP, but that would mean using possibly nonsensical values for `nsamples` and `cores`. Better to leave it as a non-optional call to `draw_samples`. Finally, we'll need a function to make predictions using our inferred values for $U$ and $V$. For user $i$ and movie $j$, a prediction is generated by drawing from $\\mathcal{N}(U_i V_j^T, \\alpha)$. To generate predictions from the sampler, we generate an $R$ matrix for each $U$ and $V$ sampled, then we combine these by averaging over the $K$ samples.\n",
904904
"\n",
905-
"\\begin{equation}\n",
905+
"$$\n",
906906
"P(R_{ij}^* \\given R, \\alpha, \\alpha_U, \\alpha_V) \\approx\n",
907907
" \\frac{1}{K} \\sum_{k=1}^K \\mathcal{N}(U_i V_j^T, \\alpha)\n",
908-
"\\end{equation}\n",
908+
"$$\n",
909909
"\n",
910910
"We'll want to inspect the individual $R$ matrices before averaging them for diagnostic purposes. So we'll write code for the averaging piece during evaluation. The function below simply draws an $R$ matrix given a $U$ and $V$ and the fixed $\\alpha$ stored in the PMF object."
911911
]
@@ -948,10 +948,10 @@
948948
"\n",
949949
"In order to understand how effective our models are, we'll need to be able to evaluate them. We'll be evaluating in terms of root mean squared error (RMSE), which looks like this:\n",
950950
"\n",
951-
"\\begin{equation}\n",
951+
"$$\n",
952952
"RMSE = \\sqrt{ \\frac{ \\sum_{i=1}^N \\sum_{j=1}^M I_{ij} (R_{ij} - R_{ij}^*)^2 }\n",
953953
" { \\sum_{i=1}^N \\sum_{j=1}^M I_{ij} } }\n",
954-
"\\end{equation}\n",
954+
"$$\n",
955955
"\n",
956956
"In this case, the RMSE can be thought of as the standard deviation of our predictions from the actual user preferences."
957957
]

0 commit comments

Comments
 (0)