NCA-GENL Question 65
Select 2You are tasked with creating a machine learning pipeline to classify text documents into categories. You decide to use Python packages to preprocess the text data and train a traditional machine learning model. Which combination of Python packages would be the most appropriate for this task?
- A
spaCy for text preprocessing, NumPy for numerical operations, and scikit-learn for model training
- B
Keras for text preprocessing, NumPy for numerical operations, and TensorFlow for model training
- C
spaCy for text preprocessing, pandas for handling datasets, and scikit-learn for model training
- D
NumPy for text tokenization, pandas for dataset handling, and PyTorch for model training
- E
spaCy for text preprocessing, matplotlib for data visualization, and scikit-learn for model training
Show answer and explanation
Correct answers: A, C
Explanation
For text classification tasks using traditional machine learning, it is essential to preprocess the text data effectively and handle numerical and dataset operations. spaCy provides robust tools for text preprocessing, such as tokenization and lemmatization, while pandas is ideal for managing datasets, and NumPy supports numerical operations. scikit-learn is the most appropriate library for building and training traditional machine learning models in this context.
- A. Correct.
Correct. spaCy is well-suited for text preprocessing, including tokenization and lemmatization. NumPy is excellent for numerical operations, and scikit-learn is a powerful library for traditional machine learning models.
- B. Incorrect.
Incorrect. Keras and TensorFlow are primarily deep learning frameworks, not traditional machine learning frameworks. While NumPy is useful, this combination is not ideal for traditional ML tasks.
- C. Correct.
Correct. spaCy is effective for text preprocessing, pandas is excellent for managing datasets, and scikit-learn provides tools for training traditional machine learning models.
- D. Incorrect.
Incorrect. NumPy is not designed for text tokenization, and PyTorch is primarily used for deep learning, not traditional machine learning.
- E. Incorrect.
Incorrect. While spaCy and scikit-learn are useful, matplotlib is primarily for visualization and does not contribute to the preprocessing or model training pipeline.