writing a program in python based on machine learning | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

writing a program in python based on machine learning

please sir, can you write a machine learning code in python which will display list of food items(best recommendation for sugar patient for consumption) based on the user of input(sugar level) . You can add addition features. Diet recommendation for sugar patient. ##################################################### user input: sugar level of patient(1 to 9). ##################################################### OUTPUT : food_items sugarlevel(in teaspoon) ---------- ------------------ Corn Flakes, 1.93 Cheerios, 0.88 Rice Krispies, 2 Special K 2.57 Wheaties, 3.08 Rice Chex, 1.62 Wheat Chex, 2.09 Corn Chex, 2.25 Shredded Wheat, 0 Lemons, 0.5 Kiwi fruit, 1.82 Apricots, 1.87 Strawberries, 0.99 Raspberries, 0.9 Blueberries, 2.02 Cranberries, 0.87 Tomatoes, 0.53 ###################################################### DATA SET : food_items sugarlevel(in teaspoon) --------------- ----------------------- Snickers bar, 5.83 Milky Way bar, 7.02 3 Musketeers bar, 8.14 Butterfinger bar, 5.58 Dove chocolate bar, 4.16 Milk Chocolate bar, 4.87 Coca-Cola, 7.25 Red Bull, 5.35 Sprite, 7.61 Jamaica Ginger Beer, 10.18 Alpen, 4.05 Cheerios, 0.88 Corn Flakes, 1.93 Cocoa Krispies, 7.83 Froot Loops, 8.46 Raisin Bran 6.35 Frosted Flakes, 7.12 Honey Smacks, 11.4 Rice Krispies, 2 Special K 2.57 Wheaties, 3.08 Trix, 6.49 Lucky Charms, 7.33 Rice Chex, 1.62 Wheat Chex, 2.09 Corn Chex, 2.25 Honey Nut Cheerios, 6.67 Reese's Puffs, 6.3 Golden Grahams, 7.1 Cocoa Puffs, 7.55 Cookie Crisp, 7.06 Shredded Wheat, 0 Cocoa Pebbles, 7.26 Banana Nut Crunch, 3.55 Mangos, 2.77 Bananas, 2.48 Apple, 2.11 Pineapples, 2 Grapes, 3.14 Lemons, 0.5 Kiwi fruit, 1.82 Apricots, 1.87 Strawberries, 0.99 Raspberries, 0.9 Blueberries, 2.02 Cranberries, 0.87 Tomatoes, 0.53

6th Mar 2018, 2:16 PM
amita
amita - avatar
12 Answers
+ 4
I understand the problem you want to solve, I just do not see a place for ML solution here. Unless you add some training set with examples (input: a concrete patient's sugar level, output: a list of items), a simple if statement or even a simple mathematical formula solves the problem easily.
7th Mar 2018, 7:20 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
What I mean is, if you want the algorithm to "learn", you have to provide the information on what the "good answer" is. Here you only have the sugar dose for each food item, but you don't provide any information on what the "good" dose is versus the patient's sugar level. So, what lacks here is a labeled dataset. In other words, a good answer here would most likely be just to *always* display a list of 10 least sugar-full items for all patients.
7th Mar 2018, 9:05 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
Hey @amita, I don't see a machine learning problem here. What should be optimized here? So far I understand that each food item has different sugar dose, but what are the rules and optimal choices for different patients?
6th Mar 2018, 8:00 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
@Kuba siekierzynski Really thanks for replying sir, Here we have to optimise the sugar level(in teaspoon ) in the available food items list from the data set... The user(sugar patient ) enter his/her sugar level(1 - 9) and from provided dataset , the machine learning algorithm must choose the list of best food items (with low sugar level food (in teaspoons )) , and display those list of best food items along with the sugar level (in teaspoon ) present in each food items. Please sir, if the dataset is insufficient, please add some required dataset, but the output must display those list of best food items along with the sugar level (in teaspoon ) present in each food items from the dataset.. Thank you.
6th Mar 2018, 10:35 PM
amita
amita - avatar
+ 1
User input : 1 to 5.7 Normal sugar level. 5.8 to 9 diabetes patients, recommends(display) the list of best food items for the patient along with the sugar level(in teaspoon ) present in each food items based on machine learning algorithm.
6th Mar 2018, 10:44 PM
amita
amita - avatar
+ 1
@kuba siekierzynski Sir, please add required training set or or modify compeletly(dataset) if necessary..but it must display the list of best food items(with low sugar level) from the given list of food items along with the sugar level present in each items of food. Thank you sir for Your Valuable response.
7th Mar 2018, 7:33 AM
amita
amita - avatar
+ 1
@kuba siekierzynski sir, Actually I am a student,took a simple project that provides(display) list of ( best recommendation) of food items from the given list of food items along with the sugar content present in the food items as the user inputs his sugar level.Using machine learning in python. The dataset I provided you may not be adequate for using in ML.. Sir, I have no idea how to do it...Sir if you could modify the dataset and display the output. Thank you.
7th Mar 2018, 7:45 AM
amita
amita - avatar
+ 1
@Kuba siekierzynski sir, it is okay if it displays a list of 10 least sugar-full items for all patients.
7th Mar 2018, 9:12 AM
amita
amita - avatar
+ 1
A user should be concerned with the sugar level since he is a diabetic's patients...
7th Mar 2018, 10:54 AM
amita
amita - avatar
+ 1
@kuba siekierzynski sir, Did you get the solution(code). please..
8th Mar 2018, 2:42 AM
amita
amita - avatar
0
@Kuba Siekierzyński sir, I'm ok with the labeled dataset.. please do some modifications (on dataset) sir to display the output... Thank you so much sir for Your help.
7th Mar 2018, 9:10 AM
amita
amita - avatar
0
whatif patient doest like the item on top 10 list ?
7th Mar 2018, 10:49 AM
Samrat
Samrat - avatar