Flooding is a big challenge in Lagos, Nigeria, inflicting harm to infrastructure, displacement of residents, and financial losses. Predicting floods precisely might help in making ready and mitigating these opposed results. This mission goals to foretell flood occurrences in Lagos utilizing historic climate knowledge and machine studying strategies.
The next instruments had been employed for this evaluation:
- Spreadsheet: For knowledge gathering, cleansing, and Labelling.
- Python: The first programming language used for knowledge evaluation and mannequin constructing.
- Pandas: For knowledge manipulation and cleansing inside the python atmosphere.
- NumPy: For numerical operations.
- Matplotlib and Seaborn: For knowledge visualisation.
- Scikit-learn: For machine studying mannequin implementation.
- Joblib: For saving and loading the machine studying mannequin.
- Jupyter Pocket book: The atmosphere for interactive knowledge evaluation and mannequin constructing.
Information Assortment: Historic climate knowledge for Lagos was collected, together with options similar to temperature, humidity, precipitation, wind velocity, and photo voltaic radiation. This was obtained from a dataset from Kaggle.
The dataset has the next columns:
- datetime: The date of the file.
- tempmax: Most temperature recorded on that day (°C).
- tempmin: Minimal temperature recorded on that day (°C).
- temp: Common temperature of the day (°C).
- feelslikemax: Most ‘looks like’ temperature recorded on that day (°C).
- feelslikemin: Minimal ‘looks like’ temperature recorded on that day (°C).
- feelslike: Common ‘looks like’ temperature of the day (°C).
- dew: Dew level (°C), the temperature at which air turns into saturated with moisture.
- humidity: Humidity share.
- precip: Quantity of precipitation (mm).
- precipprob: Likelihood of precipitation (%).
- precipcover: Proportion of the day that had precipitation (%).
- preciptype: Sort of precipitation (e.g., rain, snow).
- snow: Quantity of snowfall (mm). snowdepth:
- Snow depth (mm).
- windgust: Most wind gust velocity (km/h).
- windspeed: Common wind velocity (km/h).
- winddir: Wind course (levels).
- sealevelpressure: Sea-level atmospheric strain (hPa).
- cloudcover: Common cloud cowl (%).
- visibility: Common visibility (km).
- solarradiation: Common photo voltaic radiation (W/m²).
- solarenergy: Photo voltaic power acquired (MJ/m²).
- uvindex: UV index.
- severerisk: Threat of extreme climate occasions (could also be empty or null).
- dawn: Dawn time. sundown: Sundown time.
- moonphase: Moon part (0 = new moon, 1 = full moon).
- situations: Common climate situations (e.g., Partially cloudy, Rain).
- description: Detailed climate description.
- icon: Climate icon identifier. stations:
- Climate stations that offered knowledge.
Information Preprocessing: The next knowledge processing processes had been adopted:
- Dropped some columns that may not be helpful for the Prediction.
- Dealt with lacking values by making a lag characteristic for precipitation (precip_lag1), which represents the precipitation worth from the day prior to this.
- Dropped rows with lacking values ensuing from the lagging operation.
Characteristic Choice: The next options had been chosen for coaching the mannequin:
- datetime
- tempmax, tempmin, temp
- feelslikemax, feelslikemin, feelslike
- dew, humidity
- precip, precipprob, precipcover, preciptype
- windgust, windspeed, winddir
- sealevelpressure, cloudcover
- visibility, solarradiation, solarenergy
- uvindex, dawn, sundown, moonphase
Mannequin Coaching:
- A Random Forest Regressor was used to foretell the flood ranges.The mannequin was educated utilizing the chosen options and goal variable (flood ranges which had been decided from the precip values) and a threshold worth of fifty was set.
- For any worth higher than 50, it signifies risk of flood, this risk will increase with a rise within the precip worth.
Mannequin Analysis: The mannequin’s efficiency was evaluated utilizing applicable metrics:
- Root Imply Sq. Error
- R Squared)
The mannequin was saved for future predictions.
Prediction: The saved mannequin was loaded, and new predictions had been made utilizing a forecast dataset. The forecast dataset was preprocessed in the identical method because the historic knowledge in order to make appropriate predictions.
The mannequin was used to foretell flood ranges primarily based on new climate knowledge. The predictions are as follows:
[174.74, 125.54, 174.74, 174.74, 174.74, 174.74, 62.77, 64.233, 20.957, 7.909, 15.066, 57.11, 10.784]
The values within the prediction result’s an array whose parts correspond to every row of our forecast dataset. Mapping out these values we’ve:
From the desk above we are able to see that the mannequin predicted a excessive risk of flood from 6 July to 11 July, whereas a decrease risk on 12 and 13 July. The mannequin predicted ‘false’ from 14 to 18 July apart from 17 July which had a Low risk of flooding.
The next are the reason why the mannequin would possibly incorrectly predict outcomes:
- Information High quality: The accuracy of predictions is closely depending on the standard and completeness of the enter knowledge. Lacking values and inaccurate knowledge can have an effect on mannequin efficiency.
- Mannequin Generalisation: The mannequin could not generalise properly to unseen knowledge, particularly if the climate patterns change considerably over time.
- Characteristic Engineering: The mission depends on fundamental characteristic engineering strategies. Extra superior strategies might doubtlessly enhance the mannequin’s efficiency.
- Climate Variability: Climate situations are inherently unpredictable, and sudden adjustments can result in vital prediction errors.
The mission has efficiently developed a predictive mannequin for flood ranges in Lagos, utilising historic climate knowledge. Whereas the mannequin at the moment presents helpful insights, there are a number of avenues for enchancment. Enhancing knowledge high quality, integrating superior characteristic engineering strategies, and constantly updating the mannequin with new knowledge will considerably increase its accuracy and reliability. Exact flood prediction is essential for enhancing preparedness and mitigation methods, in the end minimising the opposed results of floods on the neighborhood. This ongoing effort will contribute to extra resilient infrastructure and higher safety for the residents of Lagos.
- Jupyter Pocket book File: https://drive.google.com/file/d/1QSfPenHHu5hqdKMAvMTpOEshOAMjnCqZ/view?usp=sharing
- Historic Dataset : https://docs.google.com/spreadsheets/d/1miorO0AFZR-WHTUp8u8OtIHRw1-SRmyE3VscT5qef4Q/edit?usp=sharing
- Forecast Dataset: https://docs.google.com/spreadsheets/d/16J_ea5yTK50j9SR_7SIXfOudZcCq-YnI/edit?usp=sharing&ouid=100002012772427202694&rtpof=true&sd=true