A comprehensive machine learning project featuring AI Salary Prediction and Live Web Scraping capabilities. This repository showcases end-to-end ML workflows from data collection to production-ready web applications.
A machine learning-powered web application for predicting IT salaries based on job titles and seniority levels.
Real-time web scraping and word cloud generation from Hacker News job postings.
Complete machine learning pipeline with data preprocessing, model training, and evaluation.
- Interactive Salary Prediction: Real-time salary estimates for data science roles
- Multiple ML Models: Random Forest (94.9% accuracy) and Linear Regression (86.9% accuracy)
- Seniority Adjustments: Junior, Middle, Senior level predictions
- Model Performance Metrics: RΒ² scores, RMSE, and comparison charts
- 742+ Training Samples: Based on real Glassdoor salary data
- Real-time Data Collection: Scrapes Hacker News "Who's Hiring" posts
- Word Cloud Generation: Visual representation of trending job keywords
- Natural Language Processing: NLTK-powered text analysis
- Error Handling: Robust scraping with timeout management
- Python 3.11+ (recommended for compatibility)
- Required packages: See
requirements.txt
# Clone the repository
git clone <repository-url>
cd BackStage-October-2025
# Install dependencies
pip install -r requirements.txt
# Generate ML models (required first time)
python regenerate_models.py
# Run the latest version of the app
streamlit run fresh_app.py --server.port 8506# Install dependencies
pip install -r requirements.txt
# Open and run the ML notebook to generate models
jupyter notebook salary_demo_colab.ipynb
# Run all cells to generate the models/ directory
# Run the Streamlit app
streamlit run simple_app.pyAfter running the setup, you should have:
models/directory with:linear_regression_model.pklrandom_forest_model.pklpreprocessor.pklkmeans_model.pklpca_model.pklmodel_metadata.jsonstreamlit run app.py
## π― How to Use
### AI Salary Predictor
1. **Start the Application**:
```bash
streamlit run fresh_app.py --server.port 8506
-
Open in Browser: Navigate to
http://localhost:8506 -
Make Predictions:
- Select your Job Title from the dropdown (Data Scientist, Data Engineer, etc.)
- Choose your Seniority Level (Junior/Middle/Senior)
- Click "οΏ½ Predict Salary"
-
View Results:
- Random Forest Prediction: High-accuracy model (94.9% RΒ²)
- Linear Regression Prediction: Interpretable baseline (86.9% RΒ²)
- Average Prediction: Combined estimate
- Model Performance Metrics: Real-time accuracy indicators
-
Open Jupyter Notebook:
jupyter notebook live_scrape.ipynb
-
Run Cells Sequentially:
- Import libraries and setup
- Scrape Hacker News "Who's Hiring" posts
- Generate word cloud visualization
- View trending job keywords
BackStage-October-2025/
βββ π― Core Applications
β βββ fresh_app.py # Latest Streamlit app (recommended)
β βββ simple_app.py # Alternative Streamlit app
β βββ app.py # Original Streamlit app
β
βββ π€ Machine Learning
β βββ salary_demo_colab.ipynb # Complete ML pipeline
β βββ regenerate_models.py # Model generation script
β βββ test_models_simple.py # Model validation
β
βββ π Web Scraping
β βββ live_scrape.ipynb # Live Hacker News scraping
β
βββ π Data
β βββ glassdoor_jobs.csv # Primary dataset (956 records)
β βββ salary_data_cleaned.csv # Processed salary data
β βββ eda_data.csv # Exploratory data analysis
β
βββ π― Generated Models
β βββ models/ # ML models (generated)
β βββ linear_regression_model.pkl
β βββ random_forest_model.pkl
β βββ preprocessor.pkl
β βββ kmeans_model.pkl
β βββ pca_model.pkl
β βββ model_metadata.json
β
βββ π Documentation
βββ README.md # This file
βββ requirements.txt # Dependencies
βββ examples.md # Usage examples
- Dataset: 956 Glassdoor job records β 742 clean salary records
- Salary Range: $13,500 - $254,000 annual compensation
- Feature Engineering: Rating, Founded year, Job Title, Job Description
- Models:
- Random Forest: 94.9% RΒ² accuracy, handles non-linear relationships
- Linear Regression: 86.9% RΒ² accuracy, interpretable baseline
- Data Scientist (131 samples)
- Data Engineer (53 samples)
- Senior Data Scientist (34 samples)
- Data Analyst (15 samples)
- Senior Data Engineer (14 samples)
- Machine Learning Engineer
- Product Manager
- Marketing Data Analyst
- Research Scientist
- And more...
- Source: Hacker News "Who's Hiring" monthly posts
- Libraries: requests, BeautifulSoup4, NLTK
- Processing: STOPWORDS filtering, word frequency analysis
- Output: matplotlib word clouds, trending keywords
- Error Handling: Timeout management, graceful failures
- Tested with: Python 3.11.4, 3.12.10, 3.13.3
- NumPy: Compatible with versions 1.24.3 - 2.3.3
- Scikit-learn: 1.6.1 - 1.7.2 (models auto-adapt)
- Key Dependencies: streamlit, pandas, joblib, matplotlib
- Random Forest Model: 94.9% RΒ² (explains 94.9% of salary variance)
- Linear Regression Model: 86.9% RΒ² (interpretable baseline)
- Training Data: 742 salary records from Glassdoor
- Salary Range: $13,500 - $254,000 annual compensation
Job Title: Data Scientist (Senior)
Random Forest: $145,000
Linear Regression: $142,000
Average: $143,500
Job Title: Data Engineer (Middle)
Random Forest: $86,846
Linear Regression: $106,197
Average: $96,522
- Total Records: 956 job postings
- Clean Salary Data: 742 records (77.6% success rate)
- Top Job Titles:
- Data Scientist: 131 records (17.7%)
- Data Engineer: 53 records (7.1%)
- Senior Data Scientist: 34 records (4.6%)
# Quick start
streamlit run fresh_app.py --server.port 8506
# With model regeneration
python regenerate_models.py && streamlit run fresh_app.py- Push repository to GitHub
- Connect to share.streamlit.io
- Deploy with one-click
- Set main file to
fresh_app.py
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
RUN python regenerate_models.py
EXPOSE 8501
CMD ["streamlit", "run", "fresh_app.py", "--server.address", "0.0.0.0", "--server.port", "8501"]- Model Updates: Re-run
regenerate_models.pywith new data - Scaling: Use Streamlit Cloud or containerization for multiple users
- Monitoring: Add logging for prediction requests and errors
- Security: Validate inputs and sanitize file uploads if added
Cause: NumPy version mismatch between model training and loading environments.
Solution:
# Regenerate models with current environment
python regenerate_models.py
# Or use the Python version that Streamlit uses
C:\Users\<username>\AppData\Local\Programs\Python\Python311\python.exe regenerate_models.py
# Then restart Streamlit
streamlit run fresh_app.py --server.port 8506Cause: Models trained with different scikit-learn version.
Solution:
# Check current version
python -c "import sklearn; print(sklearn.__version__)"
# Regenerate models to match current environment
python regenerate_models.pySolution:
# Install all required packages
pip install -r requirements.txt
# Or install specific packages
pip install streamlit pandas scikit-learn joblib matplotlib seabornSolution:
# Use different port
streamlit run fresh_app.py --server.port 8507
# Or kill existing processes
taskkill /F /IM streamlit.exe # Windows
# pkill -f streamlit # Linux/MacSolution:
# Generate models first
python regenerate_models.py
# Or run the Jupyter notebook
jupyter notebook salary_demo_colab.ipynb
# Execute all cells to create models/ directorySolution: The live scraping notebook includes timeout handling. If scraping fails:
- Check internet connection
- Try running cells individually
- Hacker News might be temporarily unavailable
- Recommended: Python 3.11+ for best compatibility
- Tested: Works with Python 3.11.4, 3.12.10, 3.13.3
- Issue: Different Python versions may have different NumPy versions
- Use
taskkill /F /IM streamlit.exeto stop Streamlit processes - PowerShell:
Get-Command pythonto find Python installations - Path format:
C:\Users\<username>\AppData\Local\Programs\Python\Python311\python.exe
If you encounter persistent compatibility issues:
- Identify your Python version:
python --version - Regenerate models with that exact Python:
python regenerate_models.py - Test model loading:
python test_models_simple.py - Restart Streamlit app
BackStage-October-2025/
βββ π― Streamlit Applications
β βββ fresh_app.py # β RECOMMENDED - Latest version with compatibility fixes
β βββ simple_app.py # Alternative version with basic features
β βββ app.py # Original version with full features
β βββ debug_app.py # Diagnostic tool for troubleshooting
β
βββ π€ Machine Learning & Data Processing
β βββ salary_demo_colab.ipynb # π Complete ML pipeline (training & evaluation)
β βββ regenerate_models.py # π§ Model generation script (fixes compatibility)
β βββ test_models_simple.py # β
Model validation and testing
β βββ test_models.py # Additional model testing utilities
β
βββ π Web Scraping & Data Collection
β βββ live_scrape.ipynb # π΄ LIVE - Hacker News scraping & word clouds
β
βββ π Datasets
β βββ glassdoor_jobs.csv # π― Primary dataset (956 job records)
β βββ salary_data_cleaned.csv # Processed salary data
β βββ eda_data.csv # Exploratory data analysis results
β
βββ π― Generated Assets
β βββ models/ # π€ ML models (auto-generated)
β β βββ linear_regression_model.pkl
β β βββ random_forest_model.pkl
β β βββ preprocessor.pkl
β β βββ kmeans_model.pkl
β β βββ pca_model.pkl
β β βββ model_metadata.json
β βββ ai_demo_outputs/ # Sample prediction outputs
β
βββ οΏ½ Documentation & Configuration
βββ README.md # π This comprehensive guide
βββ requirements.txt # π¦ Python dependencies
βββ examples.md # π‘ Usage examples
βββ prompts.txt # π― Development prompts
# 1. Clone and install
git clone <repository-url>
cd BackStage-October-2025
pip install -r requirements.txt
# 2. Generate ML models
python regenerate_models.py
# 3. Run the app
streamlit run fresh_app.py --server.port 8506
# 4. (Optional) Explore web scraping
jupyter notebook live_scrape.ipynb# 1. Update data (replace glassdoor_jobs.csv with new data)
# 2. Regenerate models
python regenerate_models.py
# 3. Test models
python test_models_simple.py
# 4. Restart app
streamlit run fresh_app.py --server.port 8506# Test model compatibility
python test_models_simple.py
# Run diagnostic app
streamlit run debug_app.py
# Check environment
python -c "import sys; print(f'Python: {sys.version}')"
python -c "import numpy; print(f'NumPy: {numpy.__version__}')"
python -c "import sklearn; print(f'Scikit-learn: {sklearn.__version__}')"- High Accuracy: 94.9% RΒ² with Random Forest model
- Real-world Data: 742 Glassdoor salary records
- Multiple Models: Compare Random Forest vs Linear Regression
- Seniority Scaling: Automatic adjustments for experience level
- Interactive UI: Clean Streamlit interface with instant predictions
- Real-time Data: Scrapes current Hacker News job postings
- Word Cloud Generation: Visual trending keywords analysis
- NLP Processing: NLTK-powered text processing and filtering
- Robust Error Handling: Timeout management and graceful failures
- Environment Compatibility: Auto-adapts to Python 3.11-3.13
- Version Management: Handles NumPy/scikit-learn compatibility issues
- Model Persistence: Joblib serialization with metadata tracking
- Debugging Tools: Comprehensive troubleshooting and validation scripts
- Check Troubleshooting Section: Common issues and solutions above
- Run Diagnostics: Use
python test_models_simple.pyto validate setup - Environment Issues: Use
regenerate_models.pyto fix compatibility - Debug Mode: Run
streamlit run debug_app.pyfor detailed error info
- Fork the repository
- Create a feature branch
- Test your changes with
python test_models_simple.py - Ensure models regenerate successfully
- Submit a pull request
- Model Updates: Always run
regenerate_models.pyafter data changes - Environment Testing: Test with multiple Python versions if possible
- Documentation: Update README.md for new features
- Compatibility: Ensure compatibility with common Python environments
- NumPy Compatibility: Solved
numpy._coremodule errors across Python versions - Environment Isolation: Handled multiple Python installations (3.11, 3.12, 3.13)
- Scikit-learn Versioning: Auto-adaptive model loading across package versions
- Real-time Web Scraping: Robust Hacker News data collection with error handling
- Production Ready: Multiple deployment-ready Streamlit applications
- Model Accuracy: 94.9% RΒ² (Random Forest), 86.9% RΒ² (Linear Regression)
- Data Processing: 77.6% success rate in salary parsing (742/956 records)
- Environment Support: Compatible with 3+ Python versions
- User Experience: < 2 second prediction response time
# Complete setup in 3 commands
git clone <repository-url> && cd BackStage-October-2025
pip install -r requirements.txt && python regenerate_models.py
streamlit run fresh_app.py --server.port 8506π Your AI Salary Predictor will be running at http://localhost:8506
Built with β€οΈ using Python, Streamlit, scikit-learn, and modern ML practices