How aadityachachra/aqi-predictor works
Project Overview
• This is a machine learning project focused on predicting air quality levels (AQI) using historical pollution data.
• It leverages TensorFlow for model training and TensorFlow Lite for deployment on resource-constrained devices such as mobile or embedded systems.
• The system includes components for data processing, model training/testing, model conversion, and result visualization.
Identifying the Main Components
• Data Layer:
• Raw Data Storage: Represented by the “Data” directory, which contains historical AQI data files, including archived and processed data.
• Processed Data (FinalData): Used for training the model.
• Model Development & Training Module:
• Training Scripts: Located in the “src” folder (e.g., train.py) that preprocess the data, build the neural network, and perform training.
• Testing and Accuracy Evaluation: Additional scripts (e.g., aqiTesting.py, accuracyCalDaily.py) that evaluate model performance.
• Model Conversion:
• Conversion to TensorFlow Lite: The final model converted to a .tflite file in the “FinalModel” directory.
• Visualization Module:
• Visual Presentation: The “Visualisation” folder holds directories for daily and monthly comparisons that display actual versus predicted AQI trends.
• Optional/Supporting Elements:
• Utility Scripts: Other scripts within “src” (e.g., 3DaysTesting.py) that may perform short-term forecasts or interface testing.
Highlighting Relationships and Data Flow
• Data Flow:
• Raw AQI data is first acquired and stored in the Data directories.
• The data preparation process (handled by scripts in “src”) cleans, formats, and converts the raw data for model training.
• Model Training Pipeline:
• A sequential neural network (with layers described in the README) is built and trained using TensorFlow.
• Followed by a model testing phase where predictions are evaluated.
• Model Conversion Process:
• Post training/testing, the model is converted to TensorFlow Lite format so it can be deployed on low-power devices.
• Visualization Flow:
• Prediction outputs from the model are aggregated (hourly into daily/monthly) and then visualized to compare against actual observed data.
• Interaction Outlines:
Architectural Patterns and Technologies
• The design follows a typical data pipeline pattern:
• Input (data collection and preprocessing) → Processing (model training and testing) → Output (model conversion and visualization).
• Key technologies include:
• TensorFlow for training the sequential neural network.
• TensorFlow Lite for converting the model which enables deployment on embedded/mobile systems.
• Python for scripting (with modules handling different tasks inside “src”).
• The modular separation (data handling, model training, conversion, and visualization) allows each component to be developed, modified, and maintained independently.
Final Checklist for the Principal Software Engineer
• Nodes for each component:
• “Data Collection & Storage” (showing both “Data/FinalData” and “Data/archive”).
• “Data Preprocessing & Preparation” (scripts in “src”).
• “Model Training Component” (train.py and its underlying neural network architecture).
• “Model Testing & Evaluation” (accuracy calculation scripts and testing modules).
• “Model Conversion to TF Lite” (output directed to “FinalModel/aqiPredictionModel.tflite”).
• “Visualization & Comparison Module” (from the “Visualisation” directory).