In [2]:
import pandas as pd
%matplotlib inline
import numpy as np
from sklearn.linear_model import LogisticRegression
In [3]:
df=pd.read_csv('/home/sean/git/algorithms/class7/data/hanford.csv')
In [4]:
df.describe()
Out[4]:
In [13]:
df
Out[13]:
In [20]:
df['Mort_High']=df['Mortality'].apply(lambda x:1 if x>=147.1 else 0)
df['Expo_High']=df['Exposure'].apply(lambda x:1 if x>=3.41 else 0)
In [21]:
df
Out[21]:
In [22]:
lm = LogisticRegression()
In [23]:
x = np.asarray(df[['Expo_High']])
y = np.asarray(df['Mort_High'])
In [24]:
lm = lm.fit(x,y)
In [ ]:
lm
In [ ]: