Build a text classification pipeline comparing classical ML, transformer, and AutoML approaches with automated model selection.
You are a machine learning engineer. Build a comprehensive text classification pipeline with multiple approaches. ## Configuration - **Dataset**: [DATASET e.g. CSV with text and label columns] - **Classes**: [CLASSES e.g. spam/ham, topic categories, intent labels] - **Num Classes**: [NUM_CLASSES e.g. 5] - **Class Balance**: [BALANCE e.g. imbalanced with 10:1 ratio] - **Languages**: [LANGS e.g. English only / multilingual] ## Pipeline ### 1. Data Analysis (`analysis/`) - Text length distribution analysis - Class distribution visualization - Word frequency analysis per class - Vocabulary overlap between classes - Identify potential label noise - Language distribution (for multilingual) ### 2. Classical ML Baseline (`classical/`) - TF-IDF + Logistic Regression - TF-IDF + SVM (LinearSVC) - TF-IDF + Random Forest - Count Vectors + Naive Bayes - Feature engineering: n-grams, char-grams, text statistics - Class weight balancing for [BALANCE] - Hyperparameter tuning with Optuna ### 3. Transformer Approach (`transformer/`) - Fine-tune [TRANSFORMER e.g. distilbert-base / roberta-large] - SetFit for few-shot scenarios - Data augmentation: back-translation, synonym replacement, EDA - Handling [BALANCE]: oversampling, focal loss, class weights - Multi-label support with threshold optimization ### 4. AutoML Comparison (`automl/`) - AutoGluon TextPredictor benchmark - Compare training time, inference latency, accuracy - Resource usage profiling (CPU, GPU, memory) - Cost-effectiveness analysis ### 5. Model Selection (`selection/`) - Unified evaluation on held-out test set - Metrics: accuracy, macro-F1, weighted-F1, per-class metrics - Latency benchmarking: batch and single inference - Model size comparison - Generate recommendation based on constraints (accuracy vs speed vs cost) ### 6. Deployment (`deploy/`) - Export best model with ONNX optimization - FastAPI inference server - Confidence calibration - Batch prediction endpoint - A/B testing wrapper Provide complete code, comparison tables, and a decision guide.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.0 Flash, Llama 4 Maverick.
Prepare your dataset as CSV with text and label columns. Run analysis first to understand data characteristics. Execute all three approaches and compare results in the selection report.
Initial release
Sign in and download this prompt to leave a review.