29 December 2018
Simple example of linear regression with Scikit-learn
by Radosław Śmigielski
Why?
- Most of existing examples, tutorials use some pre-existing datasets which
are not very clear for begginers.
- Linear regression is the most basic model and it’s the easiest to understand.
-
This example shows how to implement simple LinearRegression mode
and manipulate the data sets needed for the regression model.
- This article is going to help you to understand how to do simple
machine learning and understand what you doing, not just blindly
copy/paste staff from some randomly found tutorial.
- Next to Google Tensorflow, the most popular machine learning library.
- Easiest to start with than Tensorflow.
The problem I can see with latest Tensorflow versions is that it assumes
you, everybody are going to process Google scale amount of data which
makes things more complicated than it needs to be.
Scikit-learn basics
Things you should know before you start.
Naming conventions
- X features
- y labels
Scikit-learn LinearRegression model
This is working example of linear regressions for two functions
- y = a*x + b
- y = a * log(b * x)
And the code is here:
https://gist.github.com/radeksm/7a3c352049f3faabdcb48d921d2d602d
tags: linear regression - LinearRegression - sklearn