Bridging Knowledge Gaps with Hydroponics Software System
Capstone Project - ML Track
Author: Afsa Umutoniwase
Date: February 2026
Demo Video: Watch Demo
Repository: github.com/Afsaumutoniwase/capstone
This project combines two machine learning systems for hydroponic farming:
A hybrid question-answering system that combines retrieval-based search with generative AI to answer hydroponics questions.
chatbot_training_notebook.ipynbchat.py (Flask REST API with web UI)A classification system that recommends actions based on hydroponic sensor readings.
EzaSmart_ML_Model_Notebook.ipynbapp.py (Flask REST API)capstone/
├── chatbot_training_notebook.ipynb # GrowMate training, visualization, evaluation
├── EzaSmart_ML_Model_Notebook.ipynb # EzaSmart data engineering, model training
├── app.py # EzaSmart Flask REST API (port 5000)
├── chat.py # GrowMate Flask API + web UI (port 5001)
├── scrape.py # StackExchange data scraper
├── hydro_qa_data.json # 115 Q&A pairs from StackExchange
├── requirements.txt # Python dependencies
├── HydroGrowNet of Batavia Dataset/ # Environmental sensor data (Excel files)
├── Kaggle data/ # IoTData --Raw--.csv
├── Results/ # Trained EzaSmart model artifacts
│ ├── random_forest_model.pkl
│ ├── feature_scaler.pkl
│ ├── crop_encoder.pkl
│ └── action_encoder.pkl
└── trained_chatbot_model/ # Fine-tuned GrowMate model + visualizations
├── pytorch_model.bin
├── config.json
├── tokenizer files
└── 5 visualization PNGs
1. hydro_qa_data.json (StackExchange)
scrape.pyinstruction: Question (title + body, cleaned)response: Answer (accepted or top-voted, HTML converted to text)source: Original StackExchange URL2. HydroGrowNet of Batavia Dataset
HydroGrowNet of Batavia Dataset/all_months_sensory_data/*.xlsxCombined: 124 Q&A pairs used for retrieval index and training/validation/test splits (78% / 11% / 11%)
1. IoT Sensor Data (Kaggle)
Kaggle data/IoTData --Raw--.csv2. Synthetic Data (Rwanda Context)
Combined: Final dataset merges IoT and synthetic data with features: Crop_ID, pH_Level, EC_Value, Ambient_Temp
ROUGE Metrics (Validation Set):
Model Details:
Classification Metrics (Test Set):
Comparison:
Feature Importance: EC_Value and pH_Level are dominant predictors
git clone https://github.com/Afsaumutoniwase/capstone.git
cd capstone
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
This installs:
File: chatbot_training_notebook.ipynb
How to Run:
Open in Jupyter Notebook or VS Code
Update the BASE_DIR path (Cell 4):
BASE_DIR = Path(r"C:\Users\HP\Desktop\ALU\capstone") # Change to your path
Run cells sequentially:
Section 1: Load Base Model
Section 2-3: Load & Process Data
hydro_qa_data.json (115 Q&A pairs)Section 4: Create Instruction-Formatted Dataset
Section 5: Data Exploration & Visualization
01_data_dashboard.png, 02_keyword_analysis.png, 03_data_quality_metrics.pngSection 6: Train/Val/Test Split & Tokenization
Section 6 (Training):
trained_chatbot_model/04_training_metrics.pngSection 7: Test Predictions
05_test_predictions.pngSection 8: Retrieval-Based QA
retrieve_answers() and answer_with_retrieval()Section 8 (Hybrid QA):
answer_hybrid(): retrieval first, generation fallbackSection 9: Summary
Expected Outputs:
trained_chatbot_model/pytorch_model.bin, config.json, tokenizer filesFile: EzaSmart_ML_Model_Notebook.ipynb
How to Run:
Open in Jupyter Notebook or VS Code
Update the BASE_DIR path (Cell 2):
BASE_DIR = Path(r"C:\Users\HP\Desktop\ALU\capstone") # Change to your path
Run cells sequentially:
Section 1: Data Loading
Kaggle data/IoTData --Raw--.csvSection 2: Data Engineering
create_target_action() function based on pH/EC thresholdsSection 3: Data Visualization
data_distributions.png, correlation_matrix.png, ph_ec_by_crop.png, etc.Section 4: Model Architecture
Section 5: Performance Metrics
Section 6: Save Models
Results/ directory:
random_forest_model.pkllogistic_regression_model.pklfeature_scaler.pklcrop_encoder.pklaction_encoder.pklmodel_metadata.json (performance metrics)Expected Outputs:
Results/python app.py
Server Details:
Endpoints:
On startup, you should see:
Models loaded successfully!
* Running on http://127.0.0.1:5000
python chat.py
Server Details:
Endpoints:
On startup, you should see:
Loaded hydro_qa: 115 pairs
Batavia Q&A: 9 pairs
Building retrieval index over 124 Q&A pairs...
Retrieval index ready.
* Running on http://127.0.0.1:5001
Note: First run will download the T5 model from HuggingFace (may take several minutes)
POST /predict
Accepts sensor readings and returns recommended action.
Request Body:
{
"Crop_ID": "Lettuce",
"pH_Level": 7.2,
"EC_Value": 1.8,
"Ambient_Temp": 24.5
}
Response:
{
"prediction": "Add_pH_Down",
"recommendation": "Action: Add pH Down solution to lower pH",
"confidence": 0.98,
"input": {
"Crop_ID": "Lettuce",
"pH_Level": 7.2,
"EC_Value": 1.8,
"Ambient_Temp": 24.5
}
}
Valid Crop_ID values: Lettuce, Peppers, Tomatoes
Valid ranges: pH 3.0-9.0, EC 0.1-5.0, Temperature 10-40°C
POST /chat
Sends question and receives answer with source information.
Request Body:
{
"question": "What is the ideal pH for hydroponic lettuce?"
}
Response (Retrieval Mode):
{
"answer": "The optimal pH range for hydroponic lettuce is 5.5 to 6.5...",
"mode": "retrieval",
"confidence": 0.87,
"source": "Retrieved from knowledge base"
}
Response (Generative Mode):
{
"answer": "Hydroponic lettuce grows best at pH 5.5-6.5...",
"mode": "generative",
"confidence": null,
"source": "Generated by GrowMate AI"
}
Web UI: Visit http://localhost:5001/ for interactive chat interface
21 commits
Jupyter Notebook
99.1%
Bridging Knowledge Gaps with Hydroponics Software System
Capstone Project - ML Track
Author: Afsa Umutoniwase
Date: February 2026
Demo Video: Watch Demo
Repository: github.com/Afsaumutoniwase/capstone
This project combines two machine learning systems for hydroponic farming:
A hybrid question-answering system that combines retrieval-based search with generative AI to answer hydroponics questions.
chatbot_training_notebook.ipynbchat.py (Flask REST API with web UI)A classification system that recommends actions based on hydroponic sensor readings.
EzaSmart_ML_Model_Notebook.ipynbapp.py (Flask REST API)capstone/
├── chatbot_training_notebook.ipynb # GrowMate training, visualization, evaluation
├── EzaSmart_ML_Model_Notebook.ipynb # EzaSmart data engineering, model training
├── app.py # EzaSmart Flask REST API (port 5000)
├── chat.py # GrowMate Flask API + web UI (port 5001)
├── scrape.py # StackExchange data scraper
├── hydro_qa_data.json # 115 Q&A pairs from StackExchange
├── requirements.txt # Python dependencies
├── HydroGrowNet of Batavia Dataset/ # Environmental sensor data (Excel files)
├── Kaggle data/ # IoTData --Raw--.csv
├── Results/ # Trained EzaSmart model artifacts
│ ├── random_forest_model.pkl
│ ├── feature_scaler.pkl
│ ├── crop_encoder.pkl
│ └── action_encoder.pkl
└── trained_chatbot_model/ # Fine-tuned GrowMate model + visualizations
├── pytorch_model.bin
├── config.json
├── tokenizer files
└── 5 visualization PNGs
1. hydro_qa_data.json (StackExchange)
scrape.pyinstruction: Question (title + body, cleaned)response: Answer (accepted or top-voted, HTML converted to text)source: Original StackExchange URL2. HydroGrowNet of Batavia Dataset
HydroGrowNet of Batavia Dataset/all_months_sensory_data/*.xlsxCombined: 124 Q&A pairs used for retrieval index and training/validation/test splits (78% / 11% / 11%)
1. IoT Sensor Data (Kaggle)
Kaggle data/IoTData --Raw--.csv2. Synthetic Data (Rwanda Context)
Combined: Final dataset merges IoT and synthetic data with features: Crop_ID, pH_Level, EC_Value, Ambient_Temp
ROUGE Metrics (Validation Set):
Model Details:
Classification Metrics (Test Set):
Comparison:
Feature Importance: EC_Value and pH_Level are dominant predictors
git clone https://github.com/Afsaumutoniwase/capstone.git
cd capstone
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
This installs:
File: chatbot_training_notebook.ipynb
How to Run:
Open in Jupyter Notebook or VS Code
Update the BASE_DIR path (Cell 4):
BASE_DIR = Path(r"C:\Users\HP\Desktop\ALU\capstone") # Change to your path
Run cells sequentially:
Section 1: Load Base Model
Section 2-3: Load & Process Data
hydro_qa_data.json (115 Q&A pairs)Section 4: Create Instruction-Formatted Dataset
Section 5: Data Exploration & Visualization
01_data_dashboard.png, 02_keyword_analysis.png, 03_data_quality_metrics.pngSection 6: Train/Val/Test Split & Tokenization
Section 6 (Training):
trained_chatbot_model/04_training_metrics.pngSection 7: Test Predictions
05_test_predictions.pngSection 8: Retrieval-Based QA
retrieve_answers() and answer_with_retrieval()Section 8 (Hybrid QA):
answer_hybrid(): retrieval first, generation fallbackSection 9: Summary
Expected Outputs:
trained_chatbot_model/pytorch_model.bin, config.json, tokenizer filesFile: EzaSmart_ML_Model_Notebook.ipynb
How to Run:
Open in Jupyter Notebook or VS Code
Update the BASE_DIR path (Cell 2):
BASE_DIR = Path(r"C:\Users\HP\Desktop\ALU\capstone") # Change to your path
Run cells sequentially:
Section 1: Data Loading
Kaggle data/IoTData --Raw--.csvSection 2: Data Engineering
create_target_action() function based on pH/EC thresholdsSection 3: Data Visualization
data_distributions.png, correlation_matrix.png, ph_ec_by_crop.png, etc.Section 4: Model Architecture
Section 5: Performance Metrics
Section 6: Save Models
Results/ directory:
random_forest_model.pkllogistic_regression_model.pklfeature_scaler.pklcrop_encoder.pklaction_encoder.pklmodel_metadata.json (performance metrics)Expected Outputs:
Results/python app.py
Server Details:
Endpoints:
On startup, you should see:
Models loaded successfully!
* Running on http://127.0.0.1:5000
python chat.py
Server Details:
Endpoints:
On startup, you should see:
Loaded hydro_qa: 115 pairs
Batavia Q&A: 9 pairs
Building retrieval index over 124 Q&A pairs...
Retrieval index ready.
* Running on http://127.0.0.1:5001
Note: First run will download the T5 model from HuggingFace (may take several minutes)
POST /predict
Accepts sensor readings and returns recommended action.
Request Body:
{
"Crop_ID": "Lettuce",
"pH_Level": 7.2,
"EC_Value": 1.8,
"Ambient_Temp": 24.5
}
Response:
{
"prediction": "Add_pH_Down",
"recommendation": "Action: Add pH Down solution to lower pH",
"confidence": 0.98,
"input": {
"Crop_ID": "Lettuce",
"pH_Level": 7.2,
"EC_Value": 1.8,
"Ambient_Temp": 24.5
}
}
Valid Crop_ID values: Lettuce, Peppers, Tomatoes
Valid ranges: pH 3.0-9.0, EC 0.1-5.0, Temperature 10-40°C
POST /chat
Sends question and receives answer with source information.
Request Body:
{
"question": "What is the ideal pH for hydroponic lettuce?"
}
Response (Retrieval Mode):
{
"answer": "The optimal pH range for hydroponic lettuce is 5.5 to 6.5...",
"mode": "retrieval",
"confidence": 0.87,
"source": "Retrieved from knowledge base"
}
Response (Generative Mode):
{
"answer": "Hydroponic lettuce grows best at pH 5.5-6.5...",
"mode": "generative",
"confidence": null,
"source": "Generated by GrowMate AI"
}
Web UI: Visit http://localhost:5001/ for interactive chat interface
21 commits
Jupyter Notebook
99.1%