This program uses a machine learning model to predict the flood risk for a given UK postcode. The model is trained on historical data and is used to predict the flood risk from an unlabelled dataset. This is my playground project where I explore different machine learning models, prediction methods and data transformation techniques. Feel free to use the code as you see fit.
Flood risk is calculated from the median house price in the postcode and the flood risk.
- Clone the repository:
git clone https://github.com/Zvapo/uk-flood-risk-detection.git
- Navigate to the project directory:
cd uk-flood-risk-detection
- Create a virtual environment:
conda env create -f environment.yml
- Activate the virtual environment:
conda activate uk-flood-risk-detection
- Train the model, fine-tune the hyperparameters and create a postcode databse file by running:
python main.py
-
The folder should now contain a file called
postcodedb.csv
which contains the postcode database as well as the models trained on the postcode labelled file. -
Use the tool to predict the flood risk for a given UK postcode by running:
python main.py predict-risk <postcode>
- The tool will return the flood risk for the postcode given the model was trained on the postcode.
- Predict the flood risk for a given postcode:
python main.py predict-risk "PO7 8PR" "SO17 1NS" # add quotes if the postcode contains a space
- Add more data to the model and train it again:
python main.py add-file file <path_to_data_file> method-risk <method_name> method-house-price <method_name>
- List the available models:
python main.py list-methods
- For more information on the commands, use the help flag:
python main.py -h
- Fork the repository and create a new branch for your feature or bugfix.
- Commit your changes and push them to your fork.
- Submit a pull request describing your changes.
This project is licensed under the MIT License - see the LICENSE file for details.
- The postcode and household information is from data provided by the UK Office Of National Statistics under the Open Government Licence.
- Flood risk data is derived from the Environment Agency, adapted under the Open Government Licence
- Soil type data is derived from the National Soil Resources Institute maps of the soilscapes for England and Wales.
For support or queries, please contact:
- Twitter: @LocusIII