summarize this, keep it intresting: Models Accuracy A. Naive Bayes from scratch Starting…
- User
summarize this, keep it intresting:
Models Accuracy A. Naive Bayes from scratch Starting off, applying the main form of the naive bayes classification method equation. Naive Bayes_01: Remove new lines, chars less than 1 length, and stop words also using spacy for tokenization and lemmatization. (vocab = 31K) Naive Bayes_02: Everything in previous one, with lowercase and removing special characters. (vocab = 25K) Naive Bayes_03: replacing spacy with stanza nlp for the tokenization step.
Model Mean average F1-Score (Macro-Averaged) Naive Bayes_01 50.67% 3.57% Naive Bayes_02 48.56% 3.63% Naive Bayes_03 49.65% 3.48%
B. Scikit-learn Naive bayes: Using pre-trained models from Scikit-learn, including Multinomial NB, SKLearn Naive Bayes Count-vector: multinomial naive bayes implementation using count vectorizer. SKLearn Naive Bayes TF-IDF: multinomial naive bayes implementation using tf-idf vectorizer.
Model Mean average F1-Score (Macro-Averaged) sk_learn count vec. 68.59% 13.37% Sk_learn tf-idf vec. 54.10% 4.08%
C. Word embedding models: Applying logistic regression using 3 different embedding pre-trained models. Glove: using glove-wiki-gigaword-300 with 400K vocab, ~ 0.37GB Word2Vec: using word2vec-google-news-300 with 3M vocab, ~1.66GB FastText: using fasttext-wiki-news-subwords-300 with 1M vocab, ~0.96GB Glove_02: max_iter=200, regularization set at: C=1000.0 Glove_03: max_iter=1000, regularization set at: C=1000.0, class_weight='balanced'
Model Mean average F1-Score (Macro-Averaged) Glove 72.79% 26.67% Word2Vec 69.63% 15.96% FastText 59.05% 5.03% Glove_02 72.71% 35.7% Glove_03 71.4% 37.54%
Also I’ve tried changing the solver function for convergence between ['lbfgs', 'liblinear', 'newton-cg', 'newton-cholesky', 'sag', 'saga']. The results were almost identical, the difference rate was ~1-2% across both f1 and accuracy scores, so I stuck with the default 'lbfgs' solver.
- Assistant
- User
shorten it
- Assistant
Diving into the world of text classification, we explore a diverse array of models battling the complexities of language with numbers.
First up, our Naive Bayes models, each with a different preprocessing twist, yield modest accuracies around 50% and F1-Scores near 3.5%. Despite their nuanced approaches, including tweaks in tokenization tools and text preprocessing methods, their performance remains closely contested.
Enter the Scikit-learn Naive bayes champions, where the Count Vectorizer model shines with a 68.59% accuracy and a robust 13.37% F1-Score, significantly outperforming its TF-IDF sibling.
The heavyweight round features Word Embedding Models, with Glove, Word2Vec, and FastText entering the ring. Glove steals the show, especially with iterations adjusting its punches, peaking at a 72.79% mean average and an F1-Score of 37.54% after fine-tuning iterations and regularization, showcasing the impact of strategic parameter adjustments.
Interestingly, changing the solver, the engine of logistic regression, had a negligible effect, suggesting the choice of algorithm might not be as pivotal as the tactics deployed.