Inspiration
Our inspiration to create a crop yield predictor started as soon as we found out about the AgTech track. We started brainstorming ideas, or programs that would relate to the track, and eventually landed on the idea of the predictor.
What it does
This application is built with the Flask framework, and it essentially uses user inputted temperature, rainfall, and the type of crop. When the program is run the user is brought to a page where it asks for the temperature, rainfall, and crop type, and once everything is inputted, the program predicts the crop yield in kgs. This is all done with the use of a pre-trained RandomForestRegressor, which plays a vital role in the prediction process.
How we built it
The code was developed in Python using libraries like Pandas, NumPy, and scikit-learn. It starts by loading and preprocessing agricultural data, including one-hot encoding categorical variables and scaling features. Then, a Decision Tree Regressor model is trained and evaluated using metrics like mean squared error and R-squared score. Visualization tools are employed to illustrate the model's performance, and functionality is included for predicting crop yields based on user input, aiming to provide a comprehensive tool for agricultural yield prediction and analysis.
Challenges we ran into
While creating the code, we faced challenges with preprocessing categorical variables, especially when encoding multiple columns. This required careful handling to prevent data leakage and maintain data integrity. Another hurdle was tuning the hyperparameters of the Decision Tree Regressor model to balance complexity and performance for accurate predictions. Additionally, ensuring the code's scalability and efficiency with large datasets demanded thoughtful implementation to avoid memory problems and maintain computational speed.
Accomplishments that we're proud of
We're proud of building a code that accurately predicts agricultural yields by handling data preprocessing, model training, evaluation, and visualization effectively. Our code efficiently encodes categorical variables, scales features, and trains the model, ensuring reliable predictions. Achieving good performance metrics validates our approach, and enabling user input functionality enhances the code's usability for stakeholders in agriculture.
What we learned
Creating this code taught us important lessons about analyzing agricultural data and building predictive models. We learned how to prepare data by encoding and scaling features, which improved our model's accuracy. Additionally, we discovered effective ways to adjust model settings to make predictions more accurate without fitting the data too closely. Visualizing the data helped us understand the model's performance better and communicate results clearly. Lastly, adding user input features showed us how to make our tools more practical and user-friendly for real-world applications.
What's next for Crop Yield Prediction
The next steps for the Crop Yield Prediction code involve exploring advanced machine learning techniques, expanding datasets with additional features, and deploying the code as a user-friendly application. Continuous refinement and collaboration with experts will ensure its practical utility and effectiveness in agricultural contexts.
Log in or sign up for Devpost to join the conversation.