Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traffic Level Prediction

Project Overview

This project aims to predict traffic levels based on historical data using a machine learning model. It utilizes a Logistic Regression model trained on traffic data to classify whether there will be heavy traffic or not on a given date and junction. The prediction is made through a user-friendly Streamlit web application.

The model considers features such as hour, day, month, day of the week, whether it's a weekend, rush hour, and holidays to make accurate predictions.

Folder Structure

Traffic_Level_Prediction/
├── requirements.txt          # Python dependencies
├── data/
│   ├── traffic_data.csv      # Raw traffic data
│   └── cleaned_traffic_data.csv  # Processed data after cleaning and feature engineering
└── src/
    ├── clean_data.py         # Script to clean and preprocess the data
    ├── feature_eng.py        # Feature engineering functions
    ├── Logistic_Regression_model.py  # Model training script
    ├── main.py               # Streamlit app for predictions
    ├── __pycache__/          # Python cache files
    └── models/
        └── Logistic_Regression_model.pkl  # Trained model file

Libraries Used

The project relies on the following key Python libraries:

  • Pandas Pandas: For data manipulation and analysis.
  • Scikit-learn Scikit-learn: For machine learning algorithms, specifically Logistic Regression.
  • Streamlit Streamlit: For building the interactive web application.
  • Joblib Joblib: For saving and loading the trained model.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/Traffic_Level_Prediction.git
    cd Traffic_Level_Prediction
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    

Usage

  1. Run the data cleaning and feature engineering:

    python src/clean_data.py
    
  2. Enter the src folder:

    cd src
    
  3. Train the model:

    python Logistic_Regression_model.py
    
  4. Launch the Streamlit app:

    streamlit run main.py
    
  5. Open your browser and go to the provided URL to use the prediction app.

How It Works

  • The app takes a date input and junction selection.
  • It extracts features like hour, day, month, day of week from the date.
  • The trained Logistic Regression model predicts if there will be heavy traffic (more than 20 vehicles) or not.
  • The result is displayed to the user. d:\work\GitHub\Traffic_Level_Prediction\README.md

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages