How posi2/crop-price-prediction works
Project Type and Purpose
• This is a full-stack machine learning application focused on predicting crop prices using historical price data combined with geographical and climatic inputs.
• The project uses IBM Watson Studio for data exploration and Jupyter Notebooks, leverages Scikit-Learn and other ML libraries for modeling, and employs Flask as the web framework to deliver predictions via a web interface.
Main Components
• Data Preprocessing & Exploration:
• Jupyter Notebook (Crop Price Prediction.ipynb) where initial data analysis, visualization (histograms, heatmaps, scatter plots), and preprocessing steps (normalization, one-hot encoding, etc.) are performed.
• Machine Learning Model:
• Model creation and serialization component. This is handled by cropmodel.py, with the trained ML model saved in external files (model.json for architecture and model.h5 for weights).
• Web Application Backend:
• Flask application (cropwebapp.py) which serves as the backend to expose endpoints and integrate the ML predictions.
• Frontend/UI Layer:
• Presentation layer built using templating (HTML files in the template directory) that works together with static resources.
• Importance of the static assets and styling configuration (SCSS files in the scss folder and CSS in the static/css directory) used to style the web interface.
• External Data Sources:
• Optionally, include a component for external data ingestion or links to the dataset sources (from government data portals and rainfall data mentioned in the README) to indicate where raw data comes from.
Relationships and Interactions
• Data flows from the raw data sources → Preprocessing in the Jupyter Notebook → ML model training and serialization.
• The serialized model files (model.json and model.h5) are then utilized by the Flask backend (through cropmodel.py and cropwebapp.py) to make live predictions.
• The Flask server interacts with the presentation layer by rendering HTML templates from the ‘template’ folder and serving static assets (CSS, fonts, images) from the ‘static’ directory.
Architectural Patterns or Design Principles
• Separation of Concerns: Clearly separate the data processing/ML component from the web serving component.
• MVC-style Structure (in simplified form): Though not strictly MVC, note that the template directory (views), cropwebapp.py (controller), and underlying model logic (model) together form this separation.
• Component Reusability: The ML model’s separation allows potential reuse in other platforms (like mobile apps) or services via an API.
c. Artifacts to the “Flask Web Application” component (from cropwebapp.py), which exposes prediction endpoints.
d. From the Flask component, illustrate connections to the “UI Layer” – this includes the templates (index.html, layout.html, result.html) and the static assets (stylesheets in scss and static/css, etc.).