Advertisement
Guest User

Untitled

a guest
Jan 14th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. from sklearn import tree
  2. features = [[140, 1], [130, 1], [150, 0], [170, 0]]
  3. labels = [0,0,1,1]
  4. clf = tree.DecisionTreeClassifier()
  5. clf = clf.fit(features, labels)
  6. from colorama import init, Fore, Back, Style #Ger texten färg efter fruktens färg i detta fall Gröm för Äppelsin
  7.  
  8. init(convert=True)
  9.  
  10. print(Fore.GREEN + 'Äpple')
  11. print(clf.predict([[145, 1]])), # [0] betyder äpple
  12.  
  13. from colorama import init, Fore, Back, Style #Ger texten färg efter fruktens färg i detta fall gul (närmast orange) för appelsin
  14.  
  15. init(convert=True)
  16.  
  17. print(Fore.YELLOW + 'Applesin')
  18. print(clf.predict([[165, 0]])), # [1] betyder äppelsin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement