Should I Eat That? Food Science and Safety with the Wolfram Language

Isabel Skidmore and Gay Wilson demonstrate Wolfram Language's food database, which tracks 150+ nutrients across hundreds of thousands of foods. The tool includes USDA cold-storage guidelines: leftover pizza stays safe 3-4 days in the fridge, raw ground beef 1-2 days, raw salmon 2-3 months frozen.
Questions this video answers
Isabel Skidmore — lead nutrition developer at Wolfram Alpha; Gay Wilson — registered dietitian on the Wolfram food team.
December 20, 2022.
Over 450,000 foods (speaker also cites values "very close to 500,000 foods"); over 150 nutrients.
USDA food composition database (regular biannual updates referenced).
3–4 days (refrigerator).
Chapters
Hi, my name is Isabel Skidmore. I am the lead nutrition developer at Wolfram Alpha and I will be presenting on food and nutrition in the Wolfram language. Welcome. I'm Isabelle, by the way. I'll be talking today about food and nutrition in the Wolfram language. We've given quite a few talks about food and nutrition in the Wolfram language at previous tech conferences. I think those are available online if you ever want to go look at them. I'm going to go briefly over some of the very basic like food functionality that we have in Mathematica and Wolfram language. And then, and then we're going to go on to some sort of like audience participation things. So I think that will be fun and feel free to interrupt with questions throughout, but I'm going to try to go pretty quick here. So we do have quite a, I would say thorough nutrition support for many, many foods in our database. We have over 450,000 foods, over 150 nutrients. And these are all sort of like some really niche ones, some really common ones, stuff that you would want to know about food. So here we have omega 6 fatty acid content, omega 3 fatty acid. We also have like calorie information, stuff like that. And here, this, this formulation here, if you haven't seen it before, is kind of how you do a shorthand version of like entity value to get sort of the information out of these entities. This right here is something that we call sort of like an explicit food. So this is a, a specific instance of a food that you could like go to the store and buy. We also have a different implementation of food where you can sort of ask for the general idea of all crustaceans, all raw northern lobster crustaceans that you and will give you sort of like an average value for, for whatever nutrients that you're asking about. So there's two different ways to use it. Let me move on. We also have this really cool nutrition label property which will give you sort of like the common nutrition label that you're used to seeing on packaging. So here we have something that is, it might be a little small on the screen, so sorry about that, but you can resize it too, I'm pretty sure. Let me just do that. Yeah, so this is sort of like up to the like recommended daily value stuff that we have from the fda. And we're also like including the nutrients that are recommended by them as well. So this is kind of a standard thing. I think it's pretty cool. But it uses all the same information that our Other properties will use as well. We also, one of the ways that we do this with implicit foods, like I was saying before, is when we ask for like the general sort of version of a food, we have all of our single instances of foods tagged with so many different food attributes. So if you wanted to do for example a search of all the apples, we can give you that, we can give you all the Red Delicious apples and those you can get by going to this property, categorical property values. But you can also just get it from like natural language inputs. But here we can see sort of an example of how we might tag up a food and all the different types of things that we can tell you about a certain food. So right here we have this apples raw Red Delicious. And we have, we can give you the food type of it, which is usually sort of like the most base thing that you can ask for. And then we have a bunch of other attributes as well, like peeling type, preparation. For this one we have some brand name information, sugar, label, flavor. So there's sort of 60 here, I put 60. I think it's probably more at this point categories that you can use to sort of build your search query in a sense of what types of food you want included in the average dao value that you, that we give you.
Okay.
And it's kind of a really, really huge system. So this is just a really cool graphic that shows you sort of complex, the network of the data types that we have in our food databases. And if you want to go to this QR code, it'll take you to a website that will show you sort of like the legend for this graphic and give you kind of an idea of all the different types of information that we have about food in our database. So I highly recommend going to that. It's really cool and I think it gives you kind of an idea of the breadth of everything that we have and all the complicated things that we have going on in food. Like I said, you can get to it via natural language processing. So you can use this really cool function interpreter. We have a food interpreter. You can also get to food using more general interpreters as well. But these are the types of things that we can understand. And then this also looks pretty small. I don't think I can resize that. But this is what I was talking about with the implicit food type thing here we're going to be giving you sort of an averaged out nutrition and properties for all the Red Delicious apples that we have in our database, which I think makes it Sort of more robust and easier to work with. We've recently done a big push on trying to get our branded foods, like, up to date and our fast food. So we also have that. And I think that is really cool because I think these constructs are really useful. But I think sometimes it's hard to get working with them when you don't really know what they are. You're not familiar. So natural language, I would say, is the place to start for anyone trying to get into this food functionality that we have. Yeah. So we can also work directly with these attributes that I was talking before. So here we are working directly with food types. You can. We have a food type interpreter. I think this might be the only food attribute other than just food in general that we actually have an interpreter for. But you can get to these via some natural language processing as well. You can also run sort of like in a general entity value call to get all the food type entities that we have and see what we see, what kind of stuff that we have in there. We have, I would say almost 2,000 food types. So we have, I think, a pretty good coverage of all the different types of foods that you could want and definitely file a complaint if we don't. We're always trying to add new stuff and like I said, we are always trying to add new stuff. In previous tech conference talks, we've had sort of like a graphic that shows you how many foods we have in our database. Now we have like very close to 500,000 foods in our database, which I think is wild. But we started with sort of like this tiny amount. So we're constantly adding stuff. We get a huge amount of our foods from the USDA database. So they update it sort of bi, yearly. And so we try to keep up to date with that as well. So if you, if there's like a new packaged food or something out, we, we will do our best to get that in as well. And we're just growing and growing and growing. So I think, like I said before, the more data that we have, sort of like the more robust our averaging will be and the more data points that we have to work from. So I have this cool 3D graph that I made based on many different data points for many different foods. So we have, like I said, these implicit foods which sort of hold the abstract idea of what a food is. So like Red Delicious apples as a whole. And within that we have many, many entities. So like, I think for that, that food we may have just a handful of entities that are red delicious apples. But if you would like to, you can also go find those individual data points and bypass sort of like the automatic averaging that and look at some cool information on that. So here we have a graph with the three axes are like fat, carbs and protein content for each of these foods. And right now this kind of looks, I think, a little bit interesting. We have some clustering so we can tell some foods have similar profiles in terms of looking at these nutritional contents. And then here I have another version of that same exact graph with some colors that sort of tell you what the food type is, which I thought was pretty interesting. So we can see that our peanut butter and our almonds, which are those like blue and green dots over here kind of cluster together, which I thought was really cool because, you know, almonds, nuts, and then peanut butter is seen from nuts as well. And so we have all this. This cool stuff that you can do with all these sort of individual data points that we have in addition to our sort of more general type of querying as well. So we've also been adding new properties, so, and new data all the time. So previously we kind of had a gap where we didn't really have a lot of specific alcoholic beverages in our database. And so if people were trying to type in sort of like what they had in a day, they were like, oh, my glass of wine in the evening. And we weren't able to understand that. So we added a whole bunch of alcoholic beverages data. And here's just sort of like a sampling of what types of food types we have that live inside of this umbrella of alcoholic beverages. And we have lots of really good information about that stuff. One of the attributes that I was talking about before that we do have for these is location, which I thought was pretty cool. So you can sort of see, like, where in the world do we have like these whiskeys being produced that we have in our database. So a lot of these are going to be like branded whiskeys, obviously. So it's like whiskey that you can go buy at the store and they'll include sort of where it's made and where it's from, which I thought was pretty interesting. Another new property that we have is these cold storage time recommendations. So the USDA has recommendations on sort of like, what, how long a food will be good in the fridge or in the freezer. And so we have implemented this in our food. So you can sort of ask like, how long can I keep my raw sausage in the freezer or fridge? And then this is tiny. Sorry about that. But it'll give you sort of like that information as well, which I think is pretty cool. And so I'm going to hand over the talk to one of my team members, and we're going to have a little audience participation, and we're going to see if our sort of common sense matches up with what our recommendations are for food safety and whether or not I should eat something that I had in the fridge for a certain amount of time. So here's Gay Wilson. Good morning.
Good morning. As the registered dietitian on the food team, I'm actually very excited about us bringing these. Bringing food safety properties to the Wolfram community for education and for all sorts of. For analysis and for all sorts of purposes. As Isabelle mentioned, these are usda. This is USDA reliable data that we've incorporated. So we thought we're not going to embarrass anybody. We're not going to bring anybody up. We're going to do show of hands. So we're going to kind of. Let's. Let's check our knowledge about freezer and refrigerator storage of certain foods, and then let's check the answer in the Wolfram language. Well, actually, that's a very good point. Let me kind of clarify that. The USDA recommendations, granted, many of them, are based on safety, bacterial growth and so forth. And then some of the USDA recommendations are based on food quality. So some of this is just food quality. After a certain amount of time in your freezer. Is that salmon in your freezer a year from now, it may be safe to eat, but is it really going to be a great dinner? You know, so, you know, so it's. Some of these are actually maintaining the quality and integrity of the food versus the food safety. So I agree. Well, I'm excited to see the answers coming now. So we're going to start with this one first. Okay. It's Monday lunchtime, and I have leftover pizza in the fridge from Friday night. Here's a question. Should I eat that? Okay, let's see a show of hands for yes. Should I eat that for lunch? Just satisfaction of that. What about who says, no, don't eat that pizza from Friday? All right, let's see the answer. Oh, I didn't not even think of that category. I should have thought of that. All right, so we've got. We're about split. So. So the storage per the USDA for that pizza is three to four days. So if you got it Friday night, it's Monday lunchtime. You're okay. To have that pizza for lunch?
Yeah, yeah.
See, it's gonna be okay. Now, this is an assumption that you got it into your fridge in a certain amount of time Friday night. You didn't leave it overnight on the counter and then put it in the frid. Right. So. All right, let's do. We.
We're.
Let's move on. I bought ground beef Tuesday for a family cookout Saturday. Can I keep the raw ground beef in the refrigerator until then? Tuesday to Saturday. Who says it's okay to keep it in the fridge and then grill it Saturday? Who says that's okay? Okay, who says? Okay, who says? No, no, I wouldn't. All right, all right, so we're again, we're about split. Let's see what. What is wolframa Wolfram language. Say one to two days. You really should. In this case, it really was best to go ahead and freeze that ground beef on Tuesday when you brought it home and then put it in the fridge, say, Friday night and let that, you know, thaw in the fridge and then grill that on Saturday, one to two days. I have accidentally forgotten some ground beef in my fridge. And a few days later. Yeah, I wasn't keen to grill it at that point. Very, very conservatively. Probably it's the usda. So there. So I think it's kind of. You're on your own after that, right? You know, probably. But yeah, these are fairly conservative, I think. You know, when I. We were pulling the data, because we did on point to reliable data source. So we buy. That's why we chose the USDA and our. And actually there are probably some other. With other bodies, you know, who have different times on our food. Our own food lab was awesome idea.
I love that.
All right, let's go. And we got a couple more. I love grilled salmon with dill sauce is my personal favorite. How long can I keep raw salmon in my freezer? And is. Let's see. Show of hands for two to three months. All right, let's see a show of hands of six to eight months. Okay, let's see what wolfram language says. Two to three months. Now, in a way, the other. Those of you said six to eight months. You were right for those other fish. Lower fat fish. Because what's the difference between salmon and mackerel and say haddock and COD? Omega 3 fatty acids. Right. So this again, this is a case of probably where it's not necessarily a food safety, it's probably the food quality, because those omega 3 fatty acids in the salmons and the Mackerels, the recommended time is much shorter, two to three months in your freezer to keep that quality. Whereas if you have that haddock or cod or a lower fat fish, that's six to eight month time frame. If you ask wolfram language for haddock, it's going to tell you six to eight months. So. All right, one more. I bought a fresh butternut squash at the farmer's market, but I only need half of it for my recipe. How long can I store the rest in the refrigerator? Who says? Four to five days.
How many?
Four to five days. All right, how many eight to ten days do we have? What does the wolfram language tell us? Four to five days. Again, that's a, it's a, it depends on your squash. Right. Depends on a lot of factors there. But this is the general recommendation. Four to five days for quality of that, of that butternut squash for your, for your next recipe. Oh, I think that's my. That this is assumed a cut. A cut squash. Yeah, yeah.
In fact.
Yeah. In fact. In fact, the USDA does make a distinction on whole intact of vegetables and fruits versus the cut. Yeah. Well, you did, you guys did great. You guys did great. And we've got this for about 200 foods. We have, we do have the freezer frozen storage property. We're very excited about bringing food science and food safety because that's what food is, right? Food is science. And so we're very excited about that direction. So do check out, check out our new storage properties.
I also wanted to point out too, like, these are just sort of a testing of like a little taster, I guess, of the, the new stuff that we have. And we're always trying to add new cool stuff that we think will be useful for people. So if anyone wants to come up to me and has suggestions or things that they would actually use, I would love to hear that because we're always sort of looking for new stuff to add and wanting to make it really useful for everybody. I think we have time for questions. So we, right now we kind of are sort of angling for sort of like the average user because I think, at least in my opinion, a lot of the stuff that you can do with Mathematica and Wolfram Alpha is somewhat advanced. Like, I know there's a lot of stuff for like high school kids learning and college kids learning and stuff like that. And I think that that's really great too. But I think sort of like stuff that is useful to the everyday person. I think food is, that is a really Great opportunity for that. So that's what we've kind of tried to do for now. But like as in earlier in my talk, I don't know about industrial applications, but you can get some kind of cool like nutrition distribution and stuff like that. With 500,000 data points, there's a lot that you can analyze, there's a lot that you can look at and I think that's, that's really interesting too. But I do, I do see what you're saying, like if there's sort of more of an industrial application. We haven't really thought of it yet, but totally. Yeah, so. So I think in terms of like a scientific lens, like what you're mentioning here is, is ingredient substitution, for example, for recipes from a science lens, we don't necessarily look at it, but we do have sort of recommendations and we actually have a property that holds that information too. So if you wanted to go in and say like, what do I use instead of butter? We have some information on that too. And then in terms of recipes, I think that's a really interesting path to go down for this as well because we do have really good natural language processing for this type of stuff. So I think at the end of the day, one of our reach goals is to be able to take a recipe and ingest it and make these entity type representations of each of the ingredients and be able to calculate, I don't know, nutrition for a dish or something like that based on that. So I think that's something that we're super interested in doing and I think that we have the tools for it here and I would love to see also like the users actually try and use it for that because I've definitely tried it out, it's pretty fun. And I think there's a lot that you can sort of tease this data into that that could be useful for a lot of different applications. Yeah, I think, I think in general we try to stay away from giving like recommendations to individuals because I think we don't necessarily have all the information. There are certain things that you could use our data to calcul. If you were like watching your sodium intake or something like that, you could say like, in general, is this a high sodium food? You could look at that. But we're not going to be telling you like eat tomatoes to resist cancer or eat this to get this effect. I think that's something a little bit beyond what we're able to do. We also don't have necessarily the authority to be telling people that. So I think that's the kind of thing that we're not really interested in touching on, but we do. I mean, we are trying to keep up to date with, like, the most recent, like, data that we can give you. So we would. Maybe we'd be able to tell you, like you said, tomatoes are high in phosphorus. We would be able to eventually tell you what is the contents of the tomato, but we wouldn't say, like, you should eat this or not. Thank you guys so much.
More from Guy

Cheryl Strauss Einhorn | The Human Edge: Smarter Decisions in the Age of AI | Talks at Google

Rachel Glennerster | Innovation and the Center for Global Development | Talks at Google

Rebecca Winthrop | Rethinking the Purpose of Education in the Age of AI | Talks at Google

Dr. Robert Wachter | A Giant Leap: How AI Is Transforming Healthcare... | Talks at Google






