How shivammitra/spam-ham-project-using-word-2vec works
Purpose and execution model
This is a notebook-driven Python ML project for binary SMS/message classification: spam versus ham. Its sole implementation entry point is Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb; users launch Jupyter and execute notebook cells sequentially. There is no packaged application, service, CLI, or deployment layer.
Pipeline orchestration
The notebook owns the complete experiment lifecycle: dataset loading, text transformation, embedding creation, feature aggregation, classifier training, and evaluation. Cell ordering is the primary control-flow contract, so later model stages depend on in-memory artifacts produced by earlier cells.
• Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb
Text preprocessing boundary
Raw message text is converted into normalized token sequences through lowercasing, tokenization, stopword/non-English-word removal, and lemmatization. This stage isolates NLP cleanup from downstream vectorization and depends on NLTK language resources.
• Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb
Embedding model stage
Gensim Word2Vec is trained on the processed corpus or replaced with loaded pretrained embeddings. Its output is a vocabulary-to-dense-vector mapping; tokens missing from that vocabulary must be handled at the embedding boundary before classifier features can be formed.
• Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb
Sentence feature construction
Each message’s variable-length token list is transformed into a fixed-size feature vector by averaging its available word embeddings (“Average Word2Vec”). This is the central representation boundary between unsupervised embedding generation and supervised classification.
• Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb
Supervised classification and evaluation
Fixed-size message vectors and spam/ham labels feed scikit-learn classifiers, including Naive Bayes, SVM, and Random Forest. The notebook evaluates predictions with accuracy, precision, recall, F1 score, and a confusion matrix, enabling comparison between candidate classifiers.
• Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb
Runtime and dependencies
The runtime is Python in Jupyter Notebook. Core libraries are pandas/numpy for tabular and numerical data, NLTK for preprocessing, Gensim for Word2Vec, and scikit-learn for model training and metrics. Required NLTK datasets (punkt, stopwords, wordnet) are external downloadable resources. Repository metadata and licensing are in README.md and LICENSE.
Main entry points: Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb Experiment Notebook
Components 16
Notebook Runtime
- Jupyter Notebook · Executes the experiment cells sequentially.
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb - Experiment Notebook · Owns the full SMS spam/ham workflow.
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb
Experiment Pipeline
Sequential notebook cells share in-memory artifacts.
- SMS Messages · Raw messages with spam/ham labels.
- NLTK Resources · punkt, stopwords, and wordnet downloads.
- Text Preprocessing · Normalizes, tokenizes, filters, and lemmatizes messages.
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb - Processed Token Corpus
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb - Spam/Ham Labels
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb
Modeling
- Word2Vec Training · Builds token-to-dense-vector vocabulary.
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb - Pretrained Embeddings · Can replace locally trained Word2Vec vectors.
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb - Embedding Vocabulary · Missing tokens are excluded before aggregation.
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb - Average Word2Vec Features · Averages available token embeddings per message.
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb - Candidate Classifiers · Naive Bayes, SVM, and Random Forest.
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb - Evaluation Metrics · Accuracy, precision, recall, F1, and confusion matrix.
Spam Ham Projects Using Word2vec,AvgWord2vec.ipynb
Other components
- User
- Project Documentation
README.md - License
LICENSE
Connections 17
- User → Jupyter Notebook: launches
- Jupyter Notebook → Experiment Notebook: executes
- Experiment Notebook → SMS Messages: loads
- SMS Messages → Text Preprocessing: raw text
- NLTK Resources → Text Preprocessing: language data
- Text Preprocessing → Processed Token Corpus: normalized tokens
- Processed Token Corpus → Word2Vec Training: training corpus
- Word2Vec Training → Embedding Vocabulary: trained vectors
- Pretrained Embeddings → Embedding Vocabulary: alternative source
- Processed Token Corpus → Average Word2Vec Features: message tokens
- Embedding Vocabulary → Average Word2Vec Features: available embeddings
- SMS Messages → Spam/Ham Labels: extracts
- Average Word2Vec Features → Candidate Classifiers: feature matrix
- Spam/Ham Labels → Candidate Classifiers: training targets
- Candidate Classifiers → Evaluation Metrics: predictions
- Spam/Ham Labels → Evaluation Metrics: ground truth
- Experiment Notebook → Evaluation Metrics: reports