{"id":23196261,"url":"https://github.com/ranaessam03/climate-prediction","last_synced_at":"2026-05-05T12:32:14.714Z","repository":{"id":268226219,"uuid":"896342845","full_name":"RanaEssam03/Climate-Prediction","owner":"RanaEssam03","description":"A machine learning project to predict rainfall using Decision Tree, k-Nearest Neighbors (kNN), and Naïve Bayes, with preprocessing, model evaluation, and custom kNN implementation.","archived":false,"fork":false,"pushed_at":"2024-12-15T10:19:35.000Z","size":1702,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T16:52:05.778Z","etag":null,"topics":["decision-trees","knn-classification","machine-learning","naive-bayes-classifier","numpy","sklearn"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RanaEssam03.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-30T05:20:56.000Z","updated_at":"2024-12-16T10:53:43.000Z","dependencies_parsed_at":"2024-12-15T11:24:17.464Z","dependency_job_id":"34647fcf-5509-47eb-8eca-4681d97e0a0b","html_url":"https://github.com/RanaEssam03/Climate-Prediction","commit_stats":null,"previous_names":["ranaessam03/climate-prediction"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RanaEssam03%2FClimate-Prediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RanaEssam03%2FClimate-Prediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RanaEssam03%2FClimate-Prediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RanaEssam03%2FClimate-Prediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RanaEssam03","download_url":"https://codeload.github.com/RanaEssam03/Climate-Prediction/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247308121,"owners_count":20917634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decision-trees","knn-classification","machine-learning","naive-bayes-classifier","numpy","sklearn"],"created_at":"2024-12-18T14:17:32.927Z","updated_at":"2026-05-05T12:32:14.633Z","avatar_url":"https://github.com/RanaEssam03.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Climate Prediction\n\n### Overview\nThis project is part of the Machine Learning course at Cairo University, focused on implementing and evaluating Decision Tree, k-Nearest Neighbors (kNN), and Naïve Bayes algorithms. The task involves predicting whether it will rain using a modified weather forecast dataset obtained from Kaggle. The dataset contains six features and 2,500 observations.\n\n### Problem Statement\nThe objective is to:\n1. Preprocess the data for machine learning.\n2. Implement and evaluate machine learning models using scikit-learn.\n3. Build the kNN algorithm from scratch and compare its performance to the pre-built version.\n4. Interpret and evaluate the models with respect to their decision-making processes and performance metrics.\n\n### Dataset\nThe dataset consists of the following features:\n- **Temperature**\n- **Humidity**\n- **Wind Speed**\n- **Cloud Cover**\n- **Pressure**\n- **Rain** (target variable: 1 if it rains, 0 otherwise)\n\n### Tasks\n\n#### Task 1: Preprocessing\n1. **Missing Data Handling**\n   - Identify missing data in the dataset.\n   - Handle missing data using two techniques:\n     - Dropping missing values.\n     - Replacing missing values with the feature’s mean.\n\n2. **Feature Scaling**\n   - Check if the data is on the same scale.\n   - Apply standard scaling if necessary.\n\n3. **Data Splitting**\n   - Split the dataset into training and testing sets (80/20 split).\n\n#### Task 2: Model Implementation\n1. Implement Decision Tree, k-Nearest Neighbors (kNN), and Naïve Bayes using scikit-learn.\n2. Evaluate models using accuracy, precision, and recall metrics.\n3. Implement the k-Nearest Neighbors (kNN) algorithm from scratch.\n4. Compare the custom kNN implementation with scikit-learn’s kNN using the evaluation metrics.\n\n#### Task 3: Interpretation and Evaluation\n1. **Effect of Data Handling**\n   - Evaluate the performance of the models under different missing data handling techniques.\n\n2. **Decision Tree Explanation**\n   - Visualize the decision tree.\n   - Explain the criteria and logic used at each node for predictions.\n\n3. **Performance Metrics Report**\n   - Compare the custom kNN implementation with scikit-learn’s kNN using at least five different values of `k`.\n   - Provide detailed reports on the accuracy, precision, and recall of all models.\n\n### Dependencies\nThis project uses the following Python libraries:\n- `numpy`\n- `pandas`\n- `scikit-learn`\n- `matplotlib`\n\n### Code Highlights\n1. **Preprocessing**\n   - Handling missing data by both dropping and replacing with mean.\n   - Standard scaling of numeric features.\n\n2. **Model Implementations**\n   - Custom kNN implementation using Euclidean distance.\n   - Comparison of custom kNN with scikit-learn’s implementation.\n   - Decision Tree and Naïve Bayes implementation using scikit-learn.\n\n3. **Visualization**\n   - Decision tree visualization for interpretation.\n\n### How to Run the Code\n1. Install required libraries: `pip install numpy pandas scikit-learn matplotlib`\n2. Place the dataset file `weather_forecast_data.csv` in the same directory as the code.\n3. Run the Python script to preprocess data, train models, and evaluate performance.\n\n### Results\n- The project evaluates the impact of different missing data handling techniques.\n- Performance of models is compared using multiple metrics (accuracy, precision, recall).\n- Insights are drawn from the custom kNN implementation and decision tree visualization.\n\n### Future Work\n- Extend the dataset with additional features for better predictions.\n- Explore advanced hyperparameter tuning techniques for improved model performance.\n- Implement additional algorithms to enhance comparative analysis.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franaessam03%2Fclimate-prediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Franaessam03%2Fclimate-prediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franaessam03%2Fclimate-prediction/lists"}