Definitions

Term Notation Example(s) We say in English …
sequence \(x_1, \ldots, x_n\) A sequence \(x_1\) to \(x_n\)
summation \(\sum_{i=1}^n x_i\) or \(\displaystyle{\sum_{i=1}^n x_i}\) The sum of the terms of the sequence \(x_1\) to \(x_n\)
all reals \(\mathbb{R}\) The (set of all) real numbers (numbers on the number line)
all integers \(\mathbb{Z}\) The (set of all) integers (whole numbers including negatives, zero, and positives)
all positive integers \(\mathbb{Z}^+\) The (set of all) strictly positive integers
all natural numbers \(\mathbb{N}\) The (set of all) natural numbers. Note: we use the convention that \(0\) is a natural number.
piecewise rule definition \(f(x) = \begin{cases} x & \text{if~}x \geq 0 \\ -x & \text{if~}x<0\end{cases}\) Define \(f\) of \(x\) to be \(x\) when \(x\) is nonnegative and to be \(-x\) when \(x\) is negative
function application \(f(7)\) \(f\) of \(7\) or \(f\) applied to \(7\) or the image of \(7\) under \(f\)
\(f(z)\) \(f\) of \(z\) or \(f\) applied to \(z\) or the image of \(z\) under \(f\)
\(f(g(z))\) \(f\) of \(g\) of \(z\) or \(f\) applied to the result of \(g\) applied to \(z\)
absolute value \(\lvert -3 \rvert\) The absolute value of \(-3\)
square root \(\sqrt{9}\) The non-negative square root of \(9\)

Defining functions ratings

Recall our representation of Netflix users’ ratings of movies as \(n\)-tuples, where \(n\) is the number of movies in the database. Each component of the \(n\)-tuple is \(-1\) (didn’t like the movie), \(0\) (neutral rating or didn’t watch the movie), or \(1\) (liked the movie).

Consider the ratings \(P_1 = (-1, 0, 1)\), \(P_2 = (1, 1, -1)\), \(P_3 = (1, 1, 1)\), \(P_4 = (0,-1,1)\)

Which of \(P_1\), \(P_2\), \(P_3\) has movie preferences most similar to \(P_4\)?

One approach to answer this question: use functions to define distance between user preferences.

For example, consider the function \(d_0: \phantom{the Cartesian product of the set of ratings on 3 movies with itself} \to \phantom{\mathbb{R}}\) given by \[d_0 (~(~ (x_1, x_2, x_3), (y_1, y_2, y_3) ~) ~) = \sqrt{ (x_1 - y_1)^2 + (x_2 - y_2)^2 + (x_3 -y_3)^2}\]

Extra example: A new movie is released, and \(P_1\) and \(P_2\) watch it before \(P_3\), and give it ratings; \(P_1\) gives  and \(P_2\) gives . Should this movie be recommended to \(P_3\)? Why or why not?

Extra example: Define a new function that could be used to compare the \(4\)-tuples of ratings encoding movie preferences now that there are four movies in the database.

Definitions

Term Notation Example(s) We say in English …
sequence \(x_1, \ldots, x_n\) A sequence \(x_1\) to \(x_n\)
summation \(\sum_{i=1}^n x_i\) or \(\displaystyle{\sum_{i=1}^n x_i}\) The sum of the terms of the sequence \(x_1\) to \(x_n\)
all reals \(\mathbb{R}\) The (set of all) real numbers (numbers on the number line)
all integers \(\mathbb{Z}\) The (set of all) integers (whole numbers including negatives, zero, and positives)
all positive integers \(\mathbb{Z}^+\) The (set of all) strictly positive integers
all natural numbers \(\mathbb{N}\) The (set of all) natural numbers. Note: we use the convention that \(0\) is a natural number.
piecewise rule definition \(f(x) = \begin{cases} x & \text{if~}x \geq 0 \\ -x & \text{if~}x<0\end{cases}\) Define \(f\) of \(x\) to be \(x\) when \(x\) is nonnegative and to be \(-x\) when \(x\) is negative
function application \(f(7)\) \(f\) of \(7\) or \(f\) applied to \(7\) or the image of \(7\) under \(f\)
\(f(z)\) \(f\) of \(z\) or \(f\) applied to \(z\) or the image of \(z\) under \(f\)
\(f(g(z))\) \(f\) of \(g\) of \(z\) or \(f\) applied to the result of \(g\) applied to \(z\)
absolute value \(\lvert -3 \rvert\) The absolute value of \(-3\)
square root \(\sqrt{9}\) The non-negative square root of \(9\)

Defining functions ratings

Recall our representation of Netflix users’ ratings of movies as \(n\)-tuples, where \(n\) is the number of movies in the database. Each component of the \(n\)-tuple is \(-1\) (didn’t like the movie), \(0\) (neutral rating or didn’t watch the movie), or \(1\) (liked the movie).

Consider the ratings \(P_1 = (-1, 0, 1)\), \(P_2 = (1, 1, -1)\), \(P_3 = (1, 1, 1)\), \(P_4 = (0,-1,1)\)

Which of \(P_1\), \(P_2\), \(P_3\) has movie preferences most similar to \(P_4\)?

One approach to answer this question: use functions to define distance between user preferences.

For example, consider the function \(d_0: \phantom{the Cartesian product of the set of ratings on 3 movies with itself} \to \phantom{\mathbb{R}}\) given by \[d_0 (~(~ (x_1, x_2, x_3), (y_1, y_2, y_3) ~) ~) = \sqrt{ (x_1 - y_1)^2 + (x_2 - y_2)^2 + (x_3 -y_3)^2}\]

Extra example: A new movie is released, and \(P_1\) and \(P_2\) watch it before \(P_3\), and give it ratings; \(P_1\) gives  and \(P_2\) gives . Should this movie be recommended to \(P_3\)? Why or why not?

Extra example: Define a new function that could be used to compare the \(4\)-tuples of ratings encoding movie preferences now that there are four movies in the database.