One of my big realizations in Week 2 is that I can get wrapped up in equations and confuse myself about how the linear regression model behaves throughout the linear regression algorithm process.
For example, the linear regression model (with one variable) is,
f_{w,b}(x)=wx+b
The model as it relates to predicting values from the training set is shown as,
f_{w,b}(x^{(i)})=wx^{(i)}+b
Realizing that i is synonymous with, “something in the training set at i” was big for me. This opened my mind to the concept of “something outside of the training set.” Assuming that something can be either an x or y, we can conclude that any x (feature input) outside the training set is a candidate for prediction input. A corresponding y value in this context is realy a \hat{y} (model prediction).
For example, say our training set has the samples x = \begin{bmatrix}1\\ 2\\ 3\end{bmatrix} and values for i (zero-index) are (0, 1, 2) and implemented on the values for x are x^{(0)}=1, x^{(1)}=2, x^{(2)}=3. So, looking at the available values of x in the training set, x=1.5 is an outsider and,
f_{w,b}(1.5)=w\times1.5+b
This idea of outsider values carries over well to multiple linear regression where the model is,
f_{\vec{w},b}(\vec{x})=\vec{w}\cdot\vec{x}+b
The model as it relates to predicting values from the training set is shown,
f_{\vec{w},b}(\vec{x}^{(i)})=\vec{w}\cdot\vec{x}^{(i)}+b
Now our example includes X as a matrix \begin{bmatrix}1 & 7\\ 2 & 8\\ 3 & 9\end{bmatrix} where values for i are still (0, 1, 2) but every reference of X^{(i)} is a row vector \vec{x}^{(i)}=\begin{bmatrix}x^{(i)}_{0} & x^{(i)}_{1}\end{bmatrix}. So, X^{(2)} = \vec{x}^{(2)} = \begin{bmatrix}2 & 8\end{bmatrix}. Therefore, f_{\vec{w},b}(\vec{x}^{(2)}) in the model is,
f_{\vec{w},b}(\vec{x}^{(2)})=\vec{w}\cdot\vec{x}^{(2)}+b
or
f_{\vec{w},b}(\vec{x}^{(2)})=\vec{w}\cdot\begin{bmatrix}2 & 8\end{bmatrix}+b
The above will give us the prediction \hat{y}^{(2)} which aims to estimate the training set y^{(2)}. What would outsider values be here? Well, any values for x_{0} and x_{1} not found in the training set.