# ===================== # DATA CONFIGURATION # ===================== data: file_path: data/raw/spam.csv encoding: latin-1 test_size: 0.2 random_state: 42 label_col: 'label' text_col: 'text' use_cache: true cache_dir: data/cache # ===================== # PREPROCESSING # ===================== preprocessing: text_cleaning: remove_urls: true remove_html: true remove_punctuation: true remove_numbers: false remove_stopwords: true min_word_length: 2 stemming: false lemmatization: true parallel_processing: true n_jobs: -1 feature_engineering: enabled: true features: - contains_currency_symbol: true - contains_ip_address: true - contains_url: true - exclamation_count: true - capital_ratio: true - word_count: true - text_length: true - avg_word_length: true - pct_capital_chars: true target_column: target # ===================== # VECTORIZATION - Focused on TF-IDF # ===================== vectorizer: tfidf: max_features: [5000, 10000, 15000] min_df: [2] max_df: [0.9] ngram_range: unigram: [1, 1] bigram: [1, 2] trigram: [1, 3] norm: ['l2'] use_idf: [true] sublinear_tf: [true] dtype: float32 # ===================== # MODEL CONFIGURATION - Naive Bayes Family # ===================== model: multinomial_nb: alpha: [0.01, 0.05, 0.1, 0.2, 0.5, 1.0] fit_prior: [true, false] class_prior: [null, [0.6, 0.4], [0.5, 0.5]] bernoulli_nb: alpha: [0.01, 0.05, 0.1, 0.5, 1.0] fit_prior: [true, false] binarize: [0.0, null] class_prior: [null, [0.6, 0.4]] complement_nb: alpha: [0.01, 0.1, 0.5, 1.0] norm: [true, false] fit_prior: [true] class_prior: [null] # ===================== # TRAINING CONFIGURATION # ===================== training: tuning_method: random random_iterations: 75 cv: 5 n_jobs: -1 scoring: ['f1', 'accuracy', 'recall'] primary_metric: f1 stratified: true class_weight: balanced refit_best_model: true early_stopping: enabled: true n_iter_no_change: 5 successive_halving: enabled: true min_resources: 'smallest' reduction_factor: 3 threshold_optimization: enabled: true metric: 'f1' default_threshold: 0.5 fast_mode: true n_thresholds: 20 ensemble: enabled: true method: 'voting' top_n_models: 3 voting: 'soft' weights: null memorization: enabled: true similarity_threshold: 0.95 # ===================== # EVALUATION # ===================== evaluation: metrics: ['accuracy', 'f1', 'precision', 'recall'] error_analysis: enabled: true save_misclassified: true analyze_feature_importance: true max_samples: 1000 figures: confusion_matrix: true roc_curve: true precision_recall_curve: true threshold_optimization: true feature_importance: true # ===================== # VISUALIZATION # ===================== visualization: figures_dir: reports/figures word_cloud: width: 800 height: 600 min_font_size: 10 background_color: white max_words: 200 common_words: top_n: 30 figsize: [15, 8] feature_distributions: figsize: [12, 6] class_distribution: figsize: [8, 8] # ===================== # PRODUCTION & DEPLOYMENT # ===================== production: model_type: automatic model_path: models/spam_classifier.pkl compress_model: true quantize: true batch_size: 1000 deployment: threshold: 0.5 output_format: json batch_size: 100 cache_predictions: true cache_size: 1000 async_processing: true workers: 4