Implementation via Python

In the previous chapter related to unsupervised learning, we have learnt about several Python packages. Fortunately, these packages can be applied to supervised learning algorithms as well. The following example is for a linear regression by using a few Python datasets. The Python dataset can be downloaded from the author's website at http://www.canisius.edu/~yany/python/ffcMonthly.pkl. Assume that the data is saved under c:/temp/:

import pandas as pd 
x=pd.read_pickle("c:/temp/ffcMonthly.pkl") 
print(x.head()) 
print(x.tail()) 

The output is shown here:

We plan to run a linear regression; see the formula here:

Here, ...

Get Hands-On Data Science with Anaconda 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.