Logestic Regression
In [18]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
df=pd.read_csv("framingham_heart_disease.csv")
df.head()
Out[18]:
In [5]:
df.describe()
Out[5]:
In [19]:
df.isnull().sum()
#df.dtypes
Out[19]:
In [17]:
df.dropna(inplace=True)
In [12]:
df.isnull().sum()
Out[12]:
In [27]:
x=df.iloc[:,[1,3]].values
y=df.iloc[:,-1].values
x_train,x_test,y_train,y_test= train_test_split(x,y,test_size=0.2,random_state=10)
# lets call our model now.
from sklearn.linear_model import LogisticRegression
model=LogisticRegression()
model.fit(x_train,y_train)
model.score(x_test,y_test)
Out[27]:
Comments
Post a Comment