Skip to content

Rajdip1/Fraud_Job_Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

38 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Fraud Job Detection

An end-to-end Machine Learning application that classifies job postings as Fraudulent or Legitimate using NLP and structured features. The project includes a trained ML pipeline, a FastAPI prediction service, and a Streamlit demo UI for real-time inference.

Status: End-to-end prototype (model + API + frontend)

Social_Preview

System Architecture

Architecture_diagram

๐Ÿ“Œ Project Highlights

  • ๐Ÿง  Trained ML pipeline (scikit-learn / XGBoost)
  • ๐Ÿš€ FastAPI backend serving predictions
  • ๐ŸŽ› Streamlit UI for easy testing
  • ๐Ÿ“ฆ Model artifacts versioned and reusable
  • ๐Ÿณ Docker-ready backend (optional deployment)

๐Ÿ“‚ Repository Structure

  • app/app.py โ€” FastAPI app exposing / (health) and /predict
  • app/predict.py โ€” Model loading & prediction logic
  • st.py โ€” Streamlit demo UI (calls API)
  • model/ โ€” Saved model artifacts
    • fraud_detection_pipeline.pkl
    • decision_threshold.pkl
  • data/ โ€” CSV datasets used during development
  • model_notebooks/ โ€” Training & evaluation notebooks
  • data_cleaning/, data_processing/ โ€” Preprocessing notebooks
  • Dockerfile โ€” Backend container configuration
  • requirements.txt โ€” Python dependencies (Backend)
  • requirements2.txt โ€” Python dependencies (Frontend)

๐Ÿš€ Getting Started (Local)

1๏ธโƒฃ Setup environment

python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt

2๏ธโƒฃ Run the API

uvicorn app.app:app --host 0.0.0.0 --port 8000 --reload

Health check:

GET http://localhost:8000/

Response:

{"status":"API is running"}

๐Ÿ”ฎ Prediction Example

curl -X POST "http://localhost:8000/predict" \
  -H "Content-Type: application/json" \
  -d '{
    "job_description":"Work from home opportunity...",
    "telecommuting":1,
    "has_company_logo":0,
    "has_questions":0,
    "jd_word_count":18,
    "req_exp_enc":0,
    "employment_type_Full_time":0,
    "employment_type_Part_time":0,
    "employment_type_Temporary":0,
    "employment_type_Other":1,
    "employment_type_Unknown":0
  }'

Response includes:

  • fraud_probability
  • prediction (Fraud / Real)
  • threshold_used

๐Ÿงช API Schema Notes

  • The API expects the same feature names used during training
  • Input combines:
    • Job description text
    • Binary metadata features
    • One-hot encoded employment types
  • See app/app.py for the exact schema

๐ŸŽ› Streamlit Demo

  1. Update API URL inside st.py:
API_URL = "http://localhost:8000/predict"
  1. Run:
streamlit run st.py

The Streamlit app includes retry logic to handle cold-start delays on free hosting platforms.


๐Ÿณ Docker (Optional)

The backend is Docker-ready and can be containerized later without code changes:

docker build -t fraud-job-detection .
docker run -p 8000:8000 fraud-job-detection

๐Ÿ“ˆ Model Artifacts

Stored in model/ and loaded at runtime:

  • fraud_detection_pipeline.pkl โ€” preprocessing + classifier
  • decision_threshold.pkl โ€” probability threshold

๐Ÿ”ง Future Improvements

  • Add CI pipeline for linting & API smoke tests
  • Add unit tests for prediction logic
  • Docker Compose for API + Streamlit
  • Model monitoring & logging

๐Ÿ“œ License

MIT License


๐Ÿ‘ค Author

Rajdip

If you found this project useful, feel free to โญ the repository.

About

๐Ÿ•ต๏ธ Fraud job detection system that identifies fake job postings using Machine Learning ๐Ÿค–๐Ÿ“Š

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages