Predicting restaurant tips

Report a typo

Suppose that you work for a well-known restaurant chain and your task was to build a linear regression model that would predict how much will a client tip the restaurant based on some information about their order.

You have successfully built a model. Here is the vector of the coefficients that you've obtained:

w=(1.8, 2, 4, 0.2)\overrightarrow{\bf{w}} = (-1.8, \ 2, \ -4, \ 0.2)^\top.

Tonight, three orders have been placed so far. Here is the data regarding these orders, written in a matrix form:

X=(123510.2341106)X = \begin{pmatrix} 1 & 2 & -3 & 5 \\ 1 & 0.2 & -3 & 4 \\ 1 & 1 & 0 & 6 \end{pmatrix}.

How much tips, according to your model, will the restaurant get from these three orders together?

You can use one of the online matrix calculators, for example https://matrixcalc.org, or your favorite programming language for matrix calculations.

Tip: Find y\overrightarrow{\bf{y}} and then sum all the elements of the vector.

The input as numpy arrays
w = np.array([-1.8, 2, -4, 0.2])
x = np.array([[1, 2, -3, 5], [1, 0.2, -3, 4], [1, 1, 0, 6]])

Enter a number
___

Create a free account to access the full topic