Monday 25 February 2019

DT-ML2


pip install sklearn
pip install scipy 
____________________
from sklearn import tree                                                        
clf = tree.DecisionTreeClassifier()                                            
                                                                                
#[height, hair-length, voice-pitch]                                            
X = [ [180, 15,0],                                                              
      [167, 42,1],                                                              
      [136, 35,1],                                                              
      [174, 15,0],                                                              
      [141, 28,1]]                                                              
                                                                                
Y = ['man', 'woman', 'woman', 'man', 'woman']                                  
                                                                                
clf = clf.fit(X, Y)                                                            
prediction = clf.predict([[133, 37,1]])                                        
print(prediction)    

No comments:

Post a Comment