Pappu19

Naive Bayes

Sep 17th, 2021
618
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pandas as pd
  2.  
  3.  
  4. df = pd.read_csv('diabetes.csv')
  5.  
  6. feature_col = ["Pregnancies","Glucose","BloodPressure","SkinThickness","Insulin","BMI","DiabetesPedigreeFunction","Age"];
  7. x = df[feature_col]
  8. y = df.Outcome
  9.  
  10. from sklearn.naive_bayes import GaussianNB
  11. model =  GaussianNB()
  12. model.fit(x,y)
  13. result = model.predict([[1,85,66,29,0,26.6,0.351,31]])
  14. print(result)
RAW Paste Data