In [5]:
%matplotlib inline
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd

In [6]:
# Load data from file
data = np.loadtxt('ex2data1.txt',dtype='float',delimiter=',')
X = data[:,:-1]; y = data[:,-1:]
print "Number of data points:", X.shape[0]
print "Number of features:",X.shape[1]
print "Sample data:"
print data[:5]


Number of data points: 100
Number of features: 2
Sample data:
[[ 34.62365962  78.02469282   0.        ]
 [ 30.28671077  43.89499752   0.        ]
 [ 35.84740877  72.90219803   0.        ]
 [ 60.18259939  86.3085521    1.        ]
 [ 79.03273605  75.34437644   1.        ]]

In [7]:
df = pd.DataFrame()
df['Exam1'] = X[:,0]
df['Exam2'] = X[:,1]
df['y'] = y[:,0]
df.head()


Out[7]:
Exam1 Exam2 y
0 34.623660 78.024693 0
1 30.286711 43.894998 0
2 35.847409 72.902198 0
3 60.182599 86.308552 1
4 79.032736 75.344376 1

In [30]:
sns.lmplot('Exam1', 'Exam2',
           data=df,
           fit_reg=False,
           #logistic=True,
           hue='y',
           scatter_kws={"marker": "D",
                        "s": 100})
plt.title('Admittance')


Out[30]:
<matplotlib.text.Text at 0x10a4c9e90>

In [32]:
sns.pairplot(df,hue='y')


Out[32]:
<seaborn.axisgrid.PairGrid at 0x106e32dd0>

In [ ]: