#!/usr/bin/python3 #supervised ML apple & orange # assume smooth =0 and bumpy=1 from sklearn import tree import os smooth=0 bumpy=1 features =[[120,smooth],[130,smooth],[140,bumpy],[150,bumpy]] label=["apple","apple","orange","orange"] algo=tree.DecisionTreeClassifier() trained=algo.fit(features,label) x=[[129,bumpy]] output=trained.predict(x) print(output[0]) sound="echo "+str(output[0])+" | festival --tts" print("sound=",sound) os.system(sound) if(output=="apple"): print("apple show") os.system('eog apple.png') else: print("orange show") os.system('eog orange.jpg')