NCA-GENL Question 64
Select 2You are tasked with creating a text classification pipeline for customer reviews to classify them as Positive, Neutral, or Negative. You decide to preprocess the text data using Python to remove stop words, tokenize the text, and generate numerical feature vectors. Additionally, you want to use a traditional machine learning model, such as Logistic Regression, for classification. Which combination of Python packages would be the most appropriate to implement this solution effectively?
- A
spaCy for text preprocessing and NumPy for feature vector creation
- B
Keras for text preprocessing and TensorFlow for feature vector creation
- C
NumPy for text preprocessing and scikit-learn for classification
- D
spaCy for text preprocessing and scikit-learn for classification
- E
NumPy for text preprocessing and Keras for classification
Show answer and explanation
Correct answers: A, D
Explanation
To implement a text classification pipeline for customer reviews using traditional machine learning, spaCy is ideal for text preprocessing (such as tokenization and stop word removal), while NumPy can handle numerical feature vectors. For the classification step, scikit-learn is the most appropriate library as it provides various traditional machine learning models, including Logistic Regression. Keras and TensorFlow are better suited for deep learning workflows, making them unnecessary in this scenario.
- A. Correct.
Correct. spaCy is a powerful library for text preprocessing tasks such as tokenization, stop word removal, and lemmatization, while NumPy can be used to handle numerical feature vectors effectively.
- B. Incorrect.
Incorrect. Keras and TensorFlow are primarily designed for deep learning tasks, not traditional machine learning workflows. They are not ideal for text preprocessing and basic feature vector creation in this scenario.
- C. Incorrect.
Incorrect. NumPy is not designed for text preprocessing. While it can handle numerical arrays, it cannot process or tokenize textual data.
- D. Correct.
Correct. spaCy is well-suited for text preprocessing, and scikit-learn is a robust library for building traditional machine learning models like Logistic Regression.
- E. Incorrect.
Incorrect. NumPy is not designed for text preprocessing, and Keras is better suited for deep learning tasks rather than traditional machine learning models.