NCA-GENM Question 140
Select 4You are tasked with building a pipeline for text classification using Python. The goal is to preprocess the text data, convert it into numerical form, and train a machine learning model. Which of the following Python packages and their functionalities would you use to achieve this?
- A
spaCy for text tokenization and lemmatization
- B
NumPy for creating dense numerical arrays from text embeddings
- C
Keras for building and training a deep learning classification model
- D
Matplotlib for visualizing the training accuracy and loss
- E
Pandas for performing image preprocessing tasks
Show answer and explanation
Correct answers: A, B, C, D
Explanation
A complete text classification pipeline involves several stages: preprocessing the text, converting it into a numerical format, building and training the model, and evaluating its performance. spaCy, NumPy, and Keras are key libraries for these respective tasks, and Matplotlib can help visualize the training process. However, Pandas is not specifically relevant to image preprocessing, making it unsuitable for this task in the given scenario.
- A. Correct.
spaCy is a robust NLP library that provides functionalities for tokenization, lemmatization, and other text preprocessing tasks. These are critical steps in preparing text data for machine learning models.
- B. Correct.
NumPy is widely used for handling numerical data, and it can efficiently store and manipulate dense arrays, such as the numerical representations of text embeddings.
- C. Correct.
Keras is a high-level API within TensorFlow that is ideal for building and training machine learning models, including deep learning models for text classification.
- D. Correct.
Matplotlib is a visualization library that can be used to plot training metrics like accuracy and loss, which are important for evaluating the model's performance during training.
- E. Incorrect.
Pandas is commonly used for data manipulation and analysis, but it is not designed for image preprocessing tasks. Libraries like OpenCV or PIL would be more appropriate for image-specific preprocessing.