An advanced machine learning web application that intelligently classifies SMS messages as spam or ham using neural network technology.
- π§ Neural Network Classification - Advanced TensorFlow model with embedding layers
- β‘ Real-time Analysis - Instant SMS classification with confidence scores
- π¨ Modern UI/UX - Sleek black & white theme with smooth animations
- π± Responsive Design - Optimized for all devices and screen sizes
- π High Accuracy - 97%+ validation accuracy on test dataset
- π― Interactive Demo - Try the classifier with example messages
- π Detailed Results - Probability scores and confidence levels
- TensorFlow - Neural network framework
- Keras - High-level neural networks API
- NumPy - Numerical computing
- Pandas - Data manipulation and analysis
- React 18 - Modern UI library
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Framer Motion - Animation library
- Vite - Fast build tool
- Lucide React - Beautiful icons
- React Hot Toast - Elegant notifications
- Node.js 18+
- npm or yarn
- Python 3.8+ (for model training)
-
Clone the repository
git clone https://github.com/AyushSingh360/Neural-Network-SMS-Text-Classifier.git cd Neural-Network-SMS-Text-Classifier -
Install dependencies
npm install
-
Start development server
npm run dev
-
Open your browser
http://localhost:5173
The neural network consists of:
Input Layer (Text Sequences)
β
Embedding Layer (500 vocab, 16 dimensions)
β
Global Average Pooling 1D
β
Dense Layer (24 neurons, ReLU)
β
Dropout Layer (0.2)
β
Output Layer (1 neuron, Sigmoid)
- Training Accuracy: 98.5%
- Validation Accuracy: 97.2%
- Model Parameters: 12.8K
- Inference Time: <50ms
The model is trained on the SMS Spam Collection Dataset from the UCI Machine Learning Repository:
- Total Messages: 5,574
- Ham Messages: 4,827 (86.6%)
- Spam Messages: 747 (13.4%)
- Preprocessing: Tokenization, padding, downsampling for balance
- Enter SMS Message: Type or paste an SMS message in the text area
- Classify: Click the "Classify Message" button
- View Results: See the classification result with:
- Spam/Ham label
- Probability score
- Confidence level
- Recommended action
Try these examples to see the classifier in action:
Spam Examples:
- "Congratulations! You've won $1000! Call now to claim your prize!"
- "URGENT: Your account will be suspended. Click here immediately!"
Ham Examples:
- "Hey, are you free for lunch tomorrow?"
- "Thanks for the meeting today. Let's follow up next week."
src/
βββ components/ # React components
β βββ Header.tsx # Navigation header
β βββ Hero.tsx # Hero section
β βββ ClassifierSection.tsx # Main classifier interface
β βββ AboutSection.tsx # Project information
β βββ Footer.tsx # Footer component
β βββ MatrixBackground.tsx # Animated background
βββ App.tsx # Main application component
βββ main.tsx # Application entry point
βββ index.css # Global styles
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLintTo retrain the model with your own data:
- Prepare your dataset in TSV format with columns:
label,message - Run the Jupyter notebook
fcc_sms_text_classification.ipynb - Export the trained model for web deployment
- Update the prediction function in
ClassifierSection.tsx
| Metric | Value |
|---|---|
| Accuracy | 97.2% |
| Precision (Spam) | 96.8% |
| Recall (Spam) | 94.3% |
| F1-Score (Spam) | 95.5% |
| False Positive Rate | 1.2% |
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- freeCodeCamp.org - For the excellent machine learning curriculum
- UCI Machine Learning Repository - For the SMS Spam Collection dataset
- TensorFlow Team - For the amazing machine learning framework
- React Community - For the powerful frontend ecosystem
Ayush Singh
- GitHub: @AyushSingh360
- Project Link: Neural Network SMS Text Classifier
β Star this repository if you found it helpful!
Made with β€οΈ by AyushSingh360