## 4 Results and Discussion
### Lstm--Word2 Vec/GloVe Embeddings
```
1:\(D\leftarrow\text{Load ('twitter/youtube.csv')}\)\(\triangleright\) Load dataset from Twitter or YouTube
2:functionPreprocessText(text)
3:\(text\leftarrow\) toLowercase(text)
4:\(text\leftarrow\) removeURLsMentionsHashtagsNumbers(text)
5:\(text\leftarrow\) replaceNonWordCharsWithSpace(text)
6:\(text\leftarrow\) trimSpaces(text)
7:returntext
8:endfunction\(\triangleright\) Preprocess text data
9:\(D_{\text{processed}}\leftarrow\) ApplyPreprocessText(\(D\))
10:\(D_{\text{binary}}\leftarrow\) ConvertToBinary(\(D_{\text{processed}}\))
11:\(D_{\text{balanced}}\leftarrow\text{Balance}\left(D_{\text{binary}}\right)\)
12:\((D_{\text{train}},D_{\text{test}})\leftarrow\) TrainTestSplit(\(D_{\text{balanced}}\))
13:\(\text{model}_{\text{W2V/GloVe}}\leftarrow\) TrainEmbedding(\(D_{\text{train}}\)) \(\triangleright\) Train Word2 Vec or GloVe model on the training set
14:\(\text{max\_length}\leftarrow\) DetermineMaxLength(\(D_{\text{train}}\))
15:functionConvertToIndices(text,model\({}_{\text{W2V/GloVe}}\),max\(\_length\))
16:\(indices\leftarrow\) ConvertWordsToIndices(text,model\({}_{\text{W2V/GloVe}}\))
17:\(padded\leftarrow\) PadSequence(indices,max\(\_length\))
18:returnpadded
19:endfunction\(\triangleright\) Convert text to indices and pad sequences
20:\(D_{\text{indices}}\leftarrow\) ConvertAllToIndices(\(D_{\text{train}},\text{model}_{\text{W2V/GloVe}},\text{max\_length}\))
21:\(E\leftarrow\) CreateEmbeddingMatrix(\(\text{model}_{\text{W2V/GloVe}}\)) \(\triangleright\) Create embedding matrix from the trained model
22:\(\text{model}_{\text{LSTM}}\leftarrow\) DefineLSTMModel(\(E\)) \(\triangleright\) Define the LSTM model using the embedding matrix
23:\(\text{Compile}\left(\text{model}_{\text{LSTM}}\right)\)
24:\(\text{Train}\left(\text{model}_{\text{LSTM}},D_{\text{train}}\right)\)\(\triangleright\) Compile and train the LSTM model
25:\(predictions\leftarrow\) Predict(\(\text{model}_{\text{LSTM}},D_{\text{test}}\))
26:\(\text{Evaluate}\left(\text{model}_{\text{LSTM}},predictions\right)\)\(\triangleright\) Predict and evaluate the model on the test set
```  
**Algorithm 1** Classification with LSTM and Word2 Vec/GloVe Embeddings  
Word2 Vec embedding falls short in capturing semantic nuances: Algorithm 1 provides the configuration details for the Word2 Vec-LSTM architecture, with corresponding accuracy results in Table 4. This model achieves only 67% and 72% accuracy on the Twitter and YouTube datasets, respectively. As evident in Figure 8, the ROC and precision-recall curves showcase the model's limited discrimination capability. This significant deviation from an optimal classifier (top-left corner) indicates the prevalence of false positives due to the inability to capture nuanced semantics. We posit that Word2 Vec embeddings, despite their simplicity, are inadequate for encoding the contextual variations in language necessary for accurate spam detection. The vectors are created from a relatively small corpus and conflate multiple meanings into singular representations. This results in poor generalizations based on informal textual data with ambiguities and polysemy. More robust semantic modeling is imperative through large-scale pretraining, as offered by methods like GLoVe and ELMo. Our comparative analysis quantitatively demonstrates that Word2 Vec lags behind context-aware techniques better equipped to handle the complex features of evolving spam. Significant performance gains in our experiments on two different social media landscapes show how important more advanced embeddings are. To employ LSTM networks alongside GloVe embeddings for spam classification, as depicted in Figure 9. The text data are initially preprocessed via tokenization and padding to generate fixed-length input sequences. These sequences are then transformed into dense vector representations using 300-dimensional GloVe word vectors pretrained on a large textual corpus. The resulting embeddings capture semantic and contextual information for each token.