This repository contains the code and data for predicting potato prices based on various factors such as rainfall.
This project aims to predict the prices of potatoes using historical data. The model can help farmers and traders make informed decisions by analysing patterns and trends.
-
Data Collection and Preprocessing: We used three datasets -
potato.csv
,rainfall_news.csv
, andstate.csv
to create the final datasetfinal_potato_rainfall_data.csv
.preprocessing-steps.py
explain how to do so. -
Data Cleaning: The final dataset was cleaned to ensure accuracy and reliability. The steps are as follows:
import pandas as pd # Load the final output CSV file final_data = pd.read_csv('final_potato_rainfall_data.csv') # Remove rows where any key field is NaN final_data_cleaned = final_data.dropna(subset=['state', 'date', 'rainfall', 'price']) # Save the cleaned final output back to a CSV file final_data_cleaned.to_csv('final_potato_rainfall_data_cleaned.csv', index=False) print("Data cleaning complete. Clean output saved to 'final_potato_rainfall_data_cleaned.csv'.")
-
Modeling: The cleaned data was used to train the following models:
- K-Nearest Neighbors (KNN)
- Long Short-Term Memory (LSTM)
- Random Forest Regressor
You need to have Python installed to run the code in this repository. You can install the necessary libraries using the following command:
pip install pandas numpy scikit-learn matplotlib seaborn tensorflow
- Clone this repository:
git clone https://github.com/harshita2234/Potato-Prices-Prediction.git
- Navigate to the project directory:
cd Potato-Prices-Prediction
- Ensure you have the cleaned data file in the appropriate directory:
mv final_potato_rainfall_data_cleaned.csv .
- Run the models:
python knn.py python lstm.py python random_forest_regressor.py
Contributions are welcome! Please open an issue or submit a pull request for improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for more details.
Thanks to all the contributors and data providers for their invaluable support in making this project possible.