Created
March 25, 2018 04:29
-
-
Save rahulrkroy/2ab5ecb2e280af5fa72e5f1c384eee1b to your computer and use it in GitHub Desktop.
just basic supervised type ML with python3 on <linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment