Last active
January 5, 2021 06:12
-
-
Save mikesparr/356d0128ed7341c548e7e161e94a7bfa to your computer and use it in GitHub Desktop.
AI Demo (manual function)
This file contains 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
// creating a function by hand (traditional) | |
// feature engineering (now text has numeric index) | |
const colors = ["pink","purple","brown","red","green"] | |
const foodTypes = ["protein","fruit","vegetable","dairy","grain"] | |
// function is a model and parameters are features | |
function foodTaste(type, smell, spicy, temp, sweetness, color) { | |
if (type == 2) { | |
return "bad" // no sense going any further; foodTypes[2] is veg | |
} | |
if (color == 4) { | |
return "bad" // no sense going any further; colors[4] is green | |
} | |
if (spicy > 2) { | |
return "bad" // no sense going any further | |
} | |
if (temp > 150) { | |
return "bad" // no sense going any further | |
} | |
if (sweetness < 50) { | |
return "bad" // not cocoa puffs | |
} | |
if (smell > 25) { | |
return "bad" // forgot clothes pin to plug their nose | |
} | |
return "good" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment