User:Rangi42/Mathematical

I use this page for writing that includes a good deal of equations, since Wikipedia automatically typesets them in LaTeX. (Here is a LaTeX formatting guide.)

= GroupLens =

Recommender systems take groups of users and items, where the users have rated some of the items, and recommend new items by predicting what rating the users would assign. Predictions can be based on the items' inherent characteristics (content-based) or on the ratings of other users (collaborative filtering).

A survey of collaborative filtering techniques describes a "memory-based" technique called GroupLens designed by GroupLens Research to recommend Usenet articles. Intuitively, it recommends items to you which are rated highly by users who tend to agree with you or rated lowly by users who tend to disagree with you.

Given a set of users $$U$$, a set of items $$I$$, and a sparse matrix of ratings $$\mathbf{R}^{U \times I}$$, to predict the rating $$r_{ak}$$ that the "active user" $$a \in U$$ would give to the "active item" $$k \in I$$, we can try averaging all the other ratings by that user:


 * $$\hat{r}_{ak} = \bar{r}_{a \cdot} = \frac{\sum_{i \in I} r_{ai}}{|I|}$$

This formula is not very useful, since it predicts the same rating for every item. If other users have rated item $$i$$ more highly than $$j$$, user $$a$$ will probably do so too.


 * $$\hat{r}_{ak} = \bar{r}_{a \cdot} + \frac{\sum_{u \in U} (r_{uk} - \bar{r}_{u \cdot})}{|U|}$$

This still does not account for differing tastes. Users whose ratings are correlated with the active user should be weighted more heavily; likewise, those whose ratings inversely correlate should be weighted negatively.


 * $$\hat{r}_{ak} = \bar{r}_{a \cdot} + \frac{\sum_{u \in U} w_{au}(r_{uk} - \bar{r}_{u \cdot})}{\sum_{u \in U} |w_{au}|}$$

Here $$w_{au}$$ is the weight of user $$u$$ with respect to the active user $$a$$. One way to weight them is to use the Pearson correlation coefficient:


 * $$w_{au} = \rho_{\mathbf{R}_{a \cdot}, \mathbf{R}_{u \cdot}} = \frac{\sigma(\mathbf{R}_{a \cdot}, \mathbf{R}_{u \cdot})}{\sigma_{\mathbf{R}_{a \cdot}} \sigma_{\mathbf{R}_{u \cdot}}} = \frac{\sum_{i \in I} (r_{ai} - \bar{r}_{a \cdot}) (r_{ui} - \bar{r}_{u \cdot})}{\sqrt{\sum_{i \in I} (r_{ai} - \bar{r}_{a \cdot})^2} \sqrt{\sum_{i \in I} (r_{ui} - \bar{r}_{u \cdot})^2}}$$

The Pearson correlation coefficient is calculated based on all the items rated by both users. The adjusted cosine similarity can be used instead, which is based on all the items rated by either user; in this case, $$r_{ui} - \bar{r}_{u \cdot}$$ is taken to be 0 when user $$u$$ has not rated item $$i$$. Doing this decreases the numerator of $$w_{au}$$ relative to the denominator, which "dampens" weights towards 0 when fewer rating pairs exist with which to estimate them.

Case amplification can be used to increase the significance of extreme ratings by dampening all ratings towards 0, but doing so more for those already close to 0:


 * $$\hat{r}'_{ak} = \hat{r}_{ak} \times |\hat{r}_{ak}|^{\rho - 1}$$

Here $$\rho$$ is the case amplification power, typically 2.5.

The above system can be modified to calculate $$\hat{r}_{ak}$$ based on the ratings given by user $$a$$ to other items, rather than the ratings given to item $$k$$ by other users. In this case correlation would be measured between items rather than between users. This "item-based" collaborative filtering may be more accurate than "user-based" filtering when there are fewer items than users, such that the average item has more ratings than the average user.

Memory-based collaborative filtering does not account for item categories. Users' tastes may correlate with regard to one kind of item, anti-correlate with regard to another, and be uncorrelated with regard to a third. If the relevant categories are explicitly available to the recommender system, it can limit the set $$I$$ in the calculation of $$w_{au}$$ to those of the same kind as $$k$$. For instance, a movie recommender system could separately test correlation by genre or by lead actor; however, it could not independently derive relevant categories like "movies where a scene is repeated via a time loop or multiple perspectives" (Groundhog Day, Primer, Run Lola Run, Source Code, Rashomon, Puella Magi Madoka Magica).

= Divisibility by 3 =

Proof that if $$n$$ is divisble by 3, so is the sum of its digits:


 * $$\text{Given } n \in \mathbb{N} = d_{1}d_{2} \cdots d_{D-1}d_{D}, n \equiv 0 \, (\bmod \, 3)$$


 * $$n = \textstyle{\sum}_{i=1}^{D} d_i 10^{D-i} = \textstyle{\sum}_{i=1}^{D} d_i (10^{D-i} - 1) + \textstyle{\sum}_{i=1}^{D} d_i$$


 * $$\therefore n - (\textstyle{\sum}_{i=1}^{D} d_i (10^{D-i} - 1)) = \textstyle{\sum}_{i=1}^{D} d_i$$


 * $$\forall p \in [0, D-1] : 10^p - 1 = 9_{1}9_{2} \cdots 9_{p-1}9_{p} = 3 \times 3_{1}3_{2} \cdots 3_{p-1}3_{p} \equiv 0 \, (\bmod \, 3)$$


 * $$\therefore n - (\textstyle{\sum}_{i=1}^{D} d_i (10^{D-i} - 1)) \equiv 0 \, (\bmod \, 3)$$


 * $$\therefore \textstyle{\sum}_{i=1}^{D} d_i \equiv 0 \, (\bmod \, 3) \qquad \blacksquare$$