PROFESSIONAL-MACHINE-LEARNING-ENGINEER · Question #265
You are working on a prototype of a text classification model in a managed Vertex AI Workbench notebook. You want to quickly experiment with tokenizing text by using a Natural Language Toolkit…
The correct answer is D. Install the NLTK library from a Jupyter cell by using the !pip install nltk --user command. To quickly experiment with a new Python library like NLTK in a managed Vertex AI Workbench notebook, install it directly from a Jupyter cell.
Question
Options
- AInstall the NLTK library from a terminal by using the pip install nltk command.
- BWrite a custom Dataflow job that uses NLTK to tokenize your text and saves the output to Cloud
- CCreate a new Vertex AI Workbench notebook with a custom image that includes the NLTK library.
- DInstall the NLTK library from a Jupyter cell by using the !pip install nltk --user command.
How the community answered
(43 responses)- A2% (1)
- B2% (1)
- C7% (3)
- D88% (38)
Why each option
To quickly experiment with a new Python library like NLTK in a managed Vertex AI Workbench notebook, install it directly from a Jupyter cell.
Installing from a terminal is possible but less integrated for quick experimentation within the notebook's active kernel, and the `--user` flag is important for user-specific installations.
Writing a custom Dataflow job is a solution for large-scale data processing, not for quickly adding a library to a local notebook environment for prototyping.
Creating a new custom image for a notebook is a more involved process suitable for complex, persistent dependencies or production environments, not for rapid, ad-hoc experimentation.
Running `!pip install nltk --user` directly within a Jupyter cell in a Vertex AI Workbench notebook is the quickest and most convenient way to install a Python library for immediate use and experimentation without requiring environment restarts or custom image creation.
Concept tested: Managing Python packages in Jupyter notebooks
Source: https://cloud.google.com/vertex-ai/docs/workbench/managed/run-environment#install_custom_packages
Topics
Community Discussion
No community discussion yet for this question.