From the course: Machine Learning with Scikit-Learn

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Linear regression using scikit-learn

Linear regression using scikit-learn - scikit-learn Tutorial

From the course: Machine Learning with Scikit-Learn

Start my 1-month free trial

Linear regression using scikit-learn

- [Instructor] How do you create a complex model using scikit-learn? An easy solution is to start with a simple model like linear regression and go from there. In this image, we see a best fit line for a bunch of points. In this video, I'll show you how you can create a linear regression model using scikit-learn. So that more complex models will be easier to create. The first thing you have to do is import the libraries that you want to use. In this case Matplotlib, Pandas, train_test_split, as well as the model LinearRegression. From there, you need to load a dataset. This particular data set shows that scikit-learn requires data to be free of missing values. The goal of this dataset is to use the feature column X to predict the target column Y. Notice it looks like we have a missing value here. This is really important. As in scikit-learn, you can't have missing values input into a model. The next step is…

Contents