Path: blob/master/april_18/lessons/lesson-11-flex/code/Clustering and Regression.ipynb
1904 views
Kernel: Python 2
Clustering and Regression
In [13]:
Now we generate some sample data.
In [16]:
Out[16]:
Find Clusters
In [17]:
Out[17]:
Add Cluster Labels back to the Data Frame and Fit a Linear Model
In [20]:
Out[20]:
In [23]:
Out[23]:
0.989915079408
In [24]:
Out[24]:
Another example
In [39]:
Out[39]:
In [50]:
Out[50]:
Modeling
This time we have to fit a model to each cluster since they are not the same shape with offsets.
In [51]:
Out[51]:
Counter({0: 150, 2: 150, 1: 149, -1: 1})
In [54]:
Out[54]:
In [ ]: