# Getting started with Python and R for Data Science Show Video

Applying A linear regression model let's. Plot the data using matplotlib, plot function, to see if the data naturally, follows a linear pattern and the normal distribution, as linear regression, is not appropriate, or useful for, datasets that don't follow this assumption. So. We'll use a scatter, plot. And. We're just putting weight, versus, height. So. Weight is on our x-axis. And. Height. Is on our y-axis. We'll. Need to show this graph so, it can render on our screen. Now. Save and run the script. As. We can see the, data is linear and full is a normal distribution making. Linear, regression appropriate, to use on these data. Now. We'll define our X predictor, variable weight and our Y outcome, variable height. So. We'll use PD as pendous and. We'll. Use the data frame, function. And. We'll use weight. As. Our predictor. And. We'll make height. Our. Outcome variable. Now. Will fit a model to, the data using the fit function and use, this to predict height to given weight. So. We're using a linear regression model. And, we'll fit the model to the data. We. Can now compare the first say six predicted, values using the predict function with the actual height values to see if they're on par. So. First we're going to get all the predicted values. And, we're going to use our predictor. Variable, to, predict the outcome. And. We'll. Just print some, sub heads to differentiate. The list of predicted, values from, the actual. And. We'll have a look at the first zero, to six predictions. And. We'll. Compare, with, the first zero. To six actual, values. You. Oh right. We'll. Save and run the script. The first few predictions with the actual shows the model was not far off the mark which. Is good however to properly assess, a model we. Can use measures such as R squared which is the percentage of explained variants. So. We'll go back to our script and, we're. Going to use the score function, to get the R squared. You. And, we want to print this obviously. Now. We're just going to comment out the above lines as we.