Example of linear regression

Let's see an example of linear regression learning about salary data in Python.

We need to have some historic data with some values for learning to happen. In our scenario, we have salary data in a .csv format (Salary_Data.csv). These are example records in the .csv:

Years of experience Salary
1.1 39343
1.3 46205
1.5 37731
2 43525
2.2 39891
2.9 56642
3 60150
3.2 54445
3.3 64445
3.7 57189
3.9 63218
4 55794
4 56957
4.1 57081
4.5 61111
4.9 67938

At this point in time, we would use Python's sklearn library, which is scikit-learn used in ML.

For further information about scikit-learn, please refer to this URL at https://scikit-learn.org/stable/.

The code on how to ingest data ...

Get Practical Network Automation - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.