├── requirements.txt ├── app.GitIgnore ├── LICENSE.txt ├── README.md └── Ocean Plastic Waste Prediction.py /requirements.txt: -------------------------------------------------------------------------------- 1 | pandas 2 | numpy 3 | matplotlib 4 | seaborn 5 | scikit-learn 6 | geopandas 7 | folium 8 | -------------------------------------------------------------------------------- /app.GitIgnore: -------------------------------------------------------------------------------- 1 | # Ignore Python cache files 2 | __pycache__/ 3 | *.pyc 4 | 5 | # Ignore database file (optional, if you want to regenerate it every time) 6 | energy_consumption.db 7 | 8 | # Ignore temporary and system files 9 | *.tmp 10 | *.log 11 | .DS_Store 12 | Thumbs.db 13 | 14 | # Ignore sensitive information 15 | .env 16 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | 4 | ### **3. `LICENSE`** 5 | MIT License for open-source usage: 6 | 7 | ```plaintext 8 | MIT License 9 | 10 | Copyright (c) 2024 [Your Name] 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | 19 | The above copyright notice and this permission notice shall be included in all 20 | copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 28 | SOFTWARE. 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ocean Plastic Accumulation Prediction 2 | 3 | This project predicts the density of plastic waste accumulation in oceans based on geographical and environmental factors such as latitude, longitude, ocean currents, and wind speed. It leverages machine learning and interactive map visualization for analysis and presentation. 4 | 5 | ## Features 6 | 1. **Data Preprocessing**: Cleans and prepares data for analysis. 7 | 2. **Machine Learning**: Uses a Random Forest Regressor to predict plastic waste density. 8 | 3. **Visualization**: 9 | - Static plots for data analysis. 10 | - Interactive maps for displaying predicted accumulation areas. 11 | 12 | ## Technologies Used 13 | - **Python**: Core programming language. 14 | - **Pandas**: Data manipulation and analysis. 15 | - **NumPy**: Numerical operations. 16 | - **Matplotlib/Seaborn**: Static data visualization. 17 | - **GeoPandas**: Geospatial data handling. 18 | - **Folium**: Interactive map creation. 19 | - **Scikit-Learn**: Machine learning model and evaluation. 20 | 21 | ## Prerequisites 22 | - Python 3.7 or higher installed. 23 | - Required libraries: 24 | - `pandas` 25 | - `numpy` 26 | - `matplotlib` 27 | - `seaborn` 28 | - `scikit-learn` 29 | - `geopandas` 30 | - `folium` 31 | 32 | ## Installation 33 | 1. Clone the repository: 34 | ```bash 35 | git clone 36 | cd 37 | https://github.com/Akajiaku11 38 | -------------------------------------------------------------------------------- /Ocean Plastic Waste Prediction.py: -------------------------------------------------------------------------------- 1 | # Import necessary libraries 2 | import pandas as pd 3 | import numpy as np 4 | import matplotlib.pyplot as plt 5 | import seaborn as sns 6 | from sklearn.model_selection import train_test_split 7 | from sklearn.ensemble import RandomForestRegressor 8 | from sklearn.metrics import mean_absolute_error 9 | import geopandas as gpd # For geographical data 10 | import folium # For interactive map visualization 11 | 12 | # Step 1: Load and Preprocess Data 13 | # Assuming we have a dataset with columns like 'latitude', 'longitude', 'plastic_waste_density', 'ocean_current', 'wind_speed' 14 | data = pd.read_csv("ocean_plastic_data.csv") 15 | data.dropna(inplace=True) 16 | 17 | # Step 2: Feature Selection 18 | features = data[['latitude', 'longitude', 'ocean_current', 'wind_speed']] 19 | target = data['plastic_waste_density'] 20 | 21 | # Step 3: Split Data into Training and Test Sets 22 | X_train, X_test, y_train, y_test = train_test_split(features, target, test_size=0.3, random_state=42) 23 | 24 | # Step 4: Train Model 25 | model = RandomForestRegressor(n_estimators=100, random_state=42) 26 | model.fit(X_train, y_train) 27 | 28 | # Step 5: Make Predictions 29 | predictions = model.predict(X_test) 30 | 31 | # Step 6: Evaluate Model 32 | mae = mean_absolute_error(y_test, predictions) 33 | print(f"Mean Absolute Error: {mae}") 34 | 35 | # Step 7: Visualize Predicted Accumulation Areas 36 | # Example for visualizing prediction results on a map 37 | map_data = X_test.copy() 38 | map_data['predicted_density'] = predictions 39 | map_data = gpd.GeoDataFrame(map_data, geometry=gpd.points_from_xy(map_data.longitude, map_data.latitude)) 40 | 41 | # Create a map centered around a specific location 42 | m = folium.Map(location=[map_data['latitude'].mean(), map_data['longitude'].mean()], zoom_start=2) 43 | 44 | # Add predicted accumulation points to the map 45 | for _, row in map_data.iterrows(): 46 | folium.CircleMarker( 47 | location=[row['latitude'], row['longitude']], 48 | radius=5, 49 | color='blue' if row['predicted_density'] < 1 else 'red', 50 | fill=True, 51 | fill_opacity=0.6, 52 | popup=f"Density: {row['predicted_density']}" 53 | ).add_to(m) 54 | 55 | # Save or display map 56 | m.save("ocean_plastic_prediction_map.html") 57 | --------------------------------------------------------------------------------