How to extract ingredients and cookware from recipes?

You work for a company that is developing an application to help users with meal planning. You want to use machine learning to scan a corpus of recipes and extract each ingredient (e.g., carrot, rice, pasta) and each kitchen cookware (e.g., bowl, pot, spoon) mentioned. Each recipe is saved in an unstructured text file. What should you do?

  1. Create a text dataset on Vertex AI for entity extraction Create two entities called “ingredient” and “cookware”, and label at least 200 examples of each entity. Train an AutoML entity extraction model to extract occurrences of these entity types. Evaluate performance on a holdout dataset. Source Reference Answer
  2. Create a multi-label text classification dataset on Vertex AI. Create a test dataset, and label each recipe that corresponds to its ingredients and cookware. Train a multi-class classification model. Evaluate the model’s performance on a holdout dataset.
  3. Use the Entity Analysis method of the Natural Language API to extract the ingredients and cookware from each recipe. Evaluate the model's performance on a prelabeled dataset.
  4. Create a text dataset on Vertex AI for entity extraction. Create as many entities as there are different ingredients and cookware. Train an AutoML entity extraction model to extract those entities. Evaluate the model’s performance on a holdout dataset.

Community Votes

A
69%
C
31%

69% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The exam tests the ability to choose between a pre-trained Natural Language API and a custom AutoML model for a specific domain; the trap is assuming the pre-trained API will be sufficient for specialized terminology.

To extract specific entities like ingredients and cookware from unstructured recipe text, the best approach is to train a custom AutoML entity extraction model on Vertex AI. This method offers superior accuracy and control for specialized domains compared to using a pre-trained Natural Language API.

The most common wrong answer is C, choosing the Natural Language API. This is incorrect because the pre-trained API is designed for general entities and may not accurately identify specialized terms like specific ingredients or cookware.

Community Discussion (12 comments)

Wuthuong1234 👍 1 Selected: C
The Entity detection in the NLP API will be sufficient to identify ingredients and cookware-related words. It is much easier than training your own model in AutoML. Keep in mind that training on your own dataset could introduce some bias. Imagine your training data might cover many French or western recipes, but suddenly you get lots of Thai recipes in production. Your AutoML model would struggle to correctly identify ingredients that are not so common in western cooking such as lemongrass, kecap manis, kaffir or galangal.
andrea_c_ 👍 1 Selected: C
With A you must label a dataset. Since the entities that need to be recognized are pretty common this effort is not justified. Moreover, as specified in https://cloud.google.com/vertex-ai/docs/text-data/entity-extraction/prepare-data, "You must supply at least 1, and no more than 100, unique labels to annotate entities that you want to extract." So, it looks like the dataset has a limit of 100 entities, which I do not think is enough for this use case.
Omi_04040 👍 1 Selected: A
This option involves creating a dataset specifically for entity extraction and training an AutoML model to identify ingredients and cookware. By labeling a minimum of 200 instances for each entity, it ensures a sufficient amount of data for training. Using a holdout dataset for assessment helps evaluate the model's performance. Overall, this approach seems appropriate for the task at hand. Reference: https://cloud.google.com/vertex-ai/docs/text-data/entity-extraction/prepare-data
AzureDP900 👍 1
By choosing option A, you can leverage the power of machine learning to efficiently extract ingredients and cookware from recipes in a scalable manner. option C uses the Entity Analysis method of the Natural Language API, which might be a viable option if you had access to the API's pre-trained models. However, since you're working with Vertex AI, creating a dataset for entity extraction is a better choice.
fitri001 👍 2 Selected: A
For extracting ingredients and cookware from recipe text files, creating a text dataset on Vertex AI for entity extraction with a custom NER model is the better approach. While it requires more upfront effort for data labeling and training, it offers superior accuracy and control over the types of entities extracted. However, if you need a quick and easy solution to get started, the Natural Language API's Entity Analysis can be a temporary option. Be aware that the accuracy might be lower, and you might need to post-process the results to filter out irrelevant entities.
omermahgoub 👍 1 Selected: C
Natural Language API offers a pre-built solution for entity analysis which eliminates the need for custom model training and labeling large datasets, saving time and resources. Vertex AI AutoML can aslo be used for entity extraction but it requires data labeling and training, which can be time-consuming for a vast number of potential ingredients and cookware.
guilhermebutzke 👍 2 Selected: A
My Answer: A A: is the most suitable approach for this task because we need to identify and extract specific named entities ("ingredient" and "cookware") from the text, not classify the entire recipe into predefined categories. B: This approach would require classifying each recipe based on all possible ingredients and cookware, leading to a vast number of classes and potential performance issues. C: This pre-built solution might not be as customizable or scalable as training a specific model for this task. D: This is impractical and unnecessary as the number of potential ingredients and cookware is vast.
daidai75 👍 2
I prefer to A. Option C is not the best, because The NLP API is designed to identify general entities within text. While it's effective for broad categories, it may not be as precise for specialized domains like cooking ingredients and cookware, which require a more tailored approach.
b1a8fae 👍 4 Selected: A
A. "... you might create an entity extraction model to identify specialized terminology in legal documents or patents." I prefer this over C, which might classify carrot as vegetable, chicken as meat... custom entity extraction allows you to specify what entities you wish to extract from the text.
shadz10 👍 1 Selected: C
Reconsidering my answer and going with C Option A involves using AutoML entity extraction, which could be a valid approach. However, for extracting entities like ingredients and cookware, Google Cloud's pre-trained Natural Language API might be a more straightforward solution.
shadz10 👍 2 Selected: A
A is the correct option here
pikachu007 👍 1 Selected: C
Option B: Multi-label text classification is less suitable for identifying specific entities within text and would require labeling entire recipes with multiple classes, increasing complexity and reducing model specificity. Option C: Natural Language API's Entity Analysis might not be as accurate for this specialized domain as a model trained on custom recipe data. Option D: Creating separate entities for each ingredient and cookware type would significantly increase labeling effort and potentially hinder model generalization.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Option A is correct because it involves creating a custom Named Entity Recognition (NER) model using Vertex AI AutoML. By labeling examples for 'ingredient' and 'cookware', the model learns the specific context and vocabulary of the recipe domain, which is crucial for high accuracy. As noted in the comments, this approach provides superior control over the types of entities extracted compared to a general-purpose API.

Why the Other Options Are Wrong

Option B is incorrect because multi-label classification categorizes the entire document, not extracting specific entities within the text. Option C is incorrect because the pre-trained Natural Language API is designed for general entities and may lack the precision for specialized cooking terms, potentially misclassifying items. Option D is incorrect because creating a separate entity for every single ingredient and cookware is impractical and would lead to a model with too many classes, violating best practices and potential platform limits.

Community Comment Notes

Community comments strongly favor Option A, highlighting that custom entity extraction allows for the definition of specific domain entities. Several users noted that while Option C is easier, it lacks the precision for this specialized task. A key insight from the comments is that a custom model is necessary to handle the specific terminology of recipes effectively, which a general API might miss.

Official Reference

Exam Strategy

When faced with a question about extracting specific information from a specialized domain, always prefer training a custom model (AutoML) over using a pre-trained API. The key is to identify if the entities are general or domain-specific.

Related Analysis

Practice All PMLE Questions

Access 65 questions with complete answers and detailed explanations.

View Full PMLE Practice Test →

← Back to PMLE Study Guide