Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Calculate the mean of the values in x _ train and y _ train, storing the resulting values in variables named mean _ x and

Calculate the mean of the values in x_train and y_train, storing the resulting values in variables named mean_x and
mean_y. You may use the sum() function, as well as the variable n_train that you defined earlier in the notebook.
Print the results with text output as shown below. Round the displayed value of mean_x to 2 decimal places, and round
the displayed value of mean_y to 4 decimal places. Do not round the actual values stored within the variables
themselves, just the values displayed.
Mean of X = xxxx
Mean of Y = xxxx
We will now work toward calculating the variance of the values of in the training set as well as the variance of the values
of in the training set. The variance is a measure of how dispersed, or spread out, observations of a particular variable are.
We will calculate the desired variances by first calculating an intermediate result. Specifically, we will calculate the sum of
squared deviations for and , which are denoted by and , respectively. Formulas for these quantities are
provided below. We will use these values again in later parts of this project.
=
=1
()2=(1)2+(2)2++()2
=
=1
()2=(1)2+(2)2++()2
Create a markdown cell with unformatted text explaining that we will now be calculating and .
Calculate and , storing the results in variables named Sxx and Syy. You will need to use a loop to perform this
task. For the sake of efficient memory usage, you should not create any additional lists when performing these
calculations.
Print the results with text output as shown below. Round the displayed value of Sxx to 2 decimal places and round the
displayed value of Syy to 4 decimal places. Do not round the actual values stored within the variables themselves, just
the values displayed.
Sxx = xxxx
Syy = xxxx

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions