SHARE
TWEET

Untitled

a guest Jan 14th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top