NCA-GENL Question 182
Select 3You are tasked with building a text classification model to classify customer reviews as either 'positive' or 'negative'. To preprocess the text data and prepare it for machine learning, you decide to use spaCy for tokenization and NumPy for numerical representation. Which of the following steps would be the most appropriate actions to take?
- A
Use spaCy to tokenize the text and remove stop words.
- B
Leverage spaCy's pre-trained word embeddings to convert tokens to vectors.
- C
Use NumPy to normalize the word vectors for consistency.
- D
Directly feed the raw text data into the machine learning model without preprocessing.
- E
Manually implement tokenization and vectorization instead of using libraries like spaCy or NumPy for better performance.
Show answer and explanation
Correct answers: A, B, C
Explanation
When implementing text classification, preprocessing the text data is a critical step. Using spaCy for tokenization and leveraging its pre-trained word embeddings allows for efficient and meaningful text representation. NumPy can be used to normalize these embeddings to ensure consistent input to the machine learning model. Skipping preprocessing or opting for manual approaches would lead to inefficiency or suboptimal performance.
- A. Correct.
Correct. Tokenizing the text and removing stop words with spaCy helps in cleaning and preparing the text data for downstream tasks like classification.
- B. Correct.
Correct. Using spaCy's pre-trained word embeddings to convert tokens into vectors provides meaningful numerical representations of the words based on their semantic context.
- C. Correct.
Correct. Normalizing the word vectors using NumPy ensures they are on the same scale, which can improve the performance and stability of the machine learning model.
- D. Incorrect.
Incorrect. Feeding raw text data directly into the machine learning model without preprocessing would result in poor performance, as the model cannot interpret raw text effectively.
- E. Incorrect.
Incorrect. While manual implementation of tokenization and vectorization is possible, it is time-consuming and unnecessary given the efficiency and accuracy of libraries like spaCy and NumPy.