Advertisement
Pappu19

Decision Tree

Sep 17th, 2021
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  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.  
  8.  
  9. x = df[feature_col]
  10. y = df.Outcome
  11.  
  12. from sklearn.tree import DecisionTreeClassifier
  13. model =  DecisionTreeClassifier()
  14. model.fit(x,y)
  15. result = model.predict([[1,85,66,29,0,26.6,0.351,31]])
  16. print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement