NCA-GENL Question 185
Select 2You are tasked with building a text classification model to categorize customer reviews into 'Positive', 'Negative', and 'Neutral'. You decide to use Python packages to preprocess the text data and implement a traditional machine learning pipeline. Which combination of packages and their functionalities would be most appropriate for this task?
- A
Use spaCy to tokenize and lemmatize the text data.
- B
Use NumPy to convert text data into numerical embeddings using pre-trained word vectors.
- C
Use Keras for feature extraction from text using deep learning models.
- D
Use scikit-learn for training a support vector machine (SVM) classifier on the preprocessed text data.
- E
Use Matplotlib to visualize the training loss of the model.
Show answer and explanation
Correct answers: A, D
Explanation
To implement a text classification pipeline using traditional machine learning, text preprocessing (like tokenization and lemmatization) and model training (using scikit-learn's SVM in this case) are critical steps. spaCy is well-suited for preprocessing text, while scikit-learn is ideal for training the classifier. Other options, like Keras and Matplotlib, are not applicable as they are more relevant for deep learning and visualization tasks, respectively.
- A. Correct.
Correct: spaCy is a powerful library for text preprocessing tasks such as tokenization, lemmatization, and named entity recognition, which are essential for preparing text data for traditional machine learning models.
- B. Incorrect.
Incorrect: While NumPy is essential for numerical operations, it is not used for directly converting text data into embeddings. Libraries like spaCy or Gensim are better suited for this task.
- C. Incorrect.
Incorrect: Keras is primarily used for building deep learning models, not traditional machine learning pipelines. This question focuses on traditional ML approaches.
- D. Correct.
Correct: scikit-learn is a widely used library for implementing traditional machine learning algorithms like SVMs, making it an appropriate choice for training the classifier in this scenario.
- E. Incorrect.
Incorrect: Matplotlib is used for data visualization but is not directly relevant to the task of preprocessing or training a traditional machine learning text classification model.