|
| 1 | +Environmental Impact Analysis |
| 2 | + |
| 3 | +Environmental Impact Analysis – CO₂ Savings Prediction |
| 4 | +This use case predicts how much CO₂ emissions can be saved when replacing an Internal Combustion Engine (ICE) vehicle with an Electric Vehicle (EV). |
| 5 | +The model compares EV energy consumption with ICE fuel consumption and estimates grams of CO₂ saved per km. |
| 6 | +A positive value means the EV emits less CO₂ than the ICE vehicle. |
| 7 | + |
| 8 | +1. Data Sources |
| 9 | +The model uses five datasets: |
| 10 | +|Dataset |Description| |
| 11 | +|Pure electric consumption.csv |EV energy usage (Wh/km)| |
| 12 | +|Diesel consumption.csv | Diesel ICE fuel usage| |
| 13 | +|petrol91RON consumption.csv | Petrol 91 ICE consumption| |
| 14 | +|petrol95RON consumption.csv |Petrol 95 ICE consumption| |
| 15 | +|petrol98RON consumption.csv |Petrol 98 ICE consumption| |
| 16 | + |
| 17 | +2. Feature Engineering |
| 18 | +Key engineered features: |
| 19 | +|Feature |Meaning| |
| 20 | +|EV_gCO2_per_km |EV emissions converted from Wh/km → gCO₂/km| |
| 21 | +|ICE_CO2_Baseline |Estimated CO₂ for each ICE vehicle (fuel × emission factor)| |
| 22 | +|YearDiff |EV model year − ICE model year| |
| 23 | +|CO2_saving |ICE_CO2_Baseline − EV_gCO2_per_km| |
| 24 | +Emission factors used: |
| 25 | +• Petrol: 23.2 kg CO₂ per L |
| 26 | +• Diesel: 26.5 kg CO₂ per L |
| 27 | +• Electricity: 0.18 kg CO₂ per kWh |
| 28 | + |
| 29 | +3. Modeling Approach |
| 30 | +Three models were tested using 5-fold cross-validation: |
| 31 | +|Model |Mean R² |Mean MAE| |
| 32 | +|Linear Regression |Low |Moderate| |
| 33 | +|Random Forest |Moderate |Good| |
| 34 | +|Gradient Boosting |Best |Lowest error| |
| 35 | + |
| 36 | +Selected model: GradientBoostingRegressor |
| 37 | + |
| 38 | +4. Production Model |
| 39 | +The production code: |
| 40 | +• Loads and cleans data |
| 41 | +• Combines EV + ICE using Cartesian merge |
| 42 | +• Encodes categorical variables with OneHotEncoder |
| 43 | +• Builds a pipeline with preprocessing + model |
| 44 | +• Saves the trained model as: |
| 45 | +• co2_savings_model.pkl |
| 46 | + |
| 47 | +5. Input Schema (API request) |
| 48 | +Example JSON input: |
| 49 | +{ |
| 50 | + "Make_EV": "Tesla", |
| 51 | + "Make_ICE": "Toyota", |
| 52 | + "BodyStyle_EV": "SUV", |
| 53 | + "BodyStyle_ICE": "SUV", |
| 54 | + "FuelType_ICE": "Petrol95", |
| 55 | + "YearDiff": 5, |
| 56 | + "ICE_CO2_Baseline": 220.4 |
| 57 | +} |
| 58 | + |
| 59 | +6. Output Schema (API response) |
| 60 | +Example: |
| 61 | +{ |
| 62 | + "Predicted_CO2_Savings": 134.72 |
| 63 | +} |
| 64 | +This means the EV is predicted to emit 134.72 g/km less CO₂ than the ICE vehicle. |
| 65 | + |
| 66 | +7. FastAPI Endpoint (Draft) |
| 67 | +Endpoint structure: |
| 68 | +POST /predict |
| 69 | +Accepts JSON input → returns predicted CO₂ savings. |
| 70 | + |
| 71 | +8. How the App Team Will Use This |
| 72 | +The mobile/web app will: |
| 73 | +1. Send EV + ICE vehicle details to the API |
| 74 | +2. Receive predicted CO₂ savings |
| 75 | +3. Display environmental benefits to the user |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
0 commit comments