MTL Transformer research pipeline for Kenya crop recommendation system
# Research — Kenya Agricultural MTL Transformer
Research code for the Multi-Task Learning Transformer that powers the crop
recommendation system. This folder contains everything needed to reproduce
the data pipeline, model training, and analysis — separate from the
production Django server (`neuro_symbolic_engine/`).
## Directory Structure
```
research/
├── scripts/
│ ├── crop_metadata.py ← Shared constants (22 crops, harvest months, etc.)
│ ├── data_acquisition/
│ │ └── download_weather_data.py ← NASA POWER weather data downloader
│ ├── preprocessing/
│ │ ├── preprocess_food_prices.py ← Clean WFP food prices
│ │ ├── preprocess_yield.py ← Filter FAO yield data to Kenya
│ │ ├── preprocess_ag_production.py← Agricultural production preprocessing
│ │ ├── add_confidence_weights.py ← Add confidence weights to yield data
│ │ ├── build_weather_sequences.py ← 12-month sliding weather windows
│ │ ├── build_price_sequences.py ← 12-month price windows + 6-month look-ahead
│ │ ├── build_yield_outputs.py ← Yield baseline computation
│ │ ├── build_training_forms.py ← Merge all datasets into training samples
│ │ └── compute_reference_prices.py← National avg price sequences for inference
│ └── model/
│ └── mtl_transformer.py ← Full model: architecture + training loop
├── notebooks/
│ ├── 01_data_exploration.ipynb ← EDA on raw datasets
│ ├── 02_preprocessing.ipynb ← Interactive preprocessing walkthrough
│ ├── 03_train_val_test_split.ipynb ← Train/val/test split
│ └── 04_mtl_transformer_training.ipynb ← Model training (run on Colab GPU)
├── data/
│ ├── raw/ ← Original source datasets
│ │ ├── Crop_recommendation.csv
│ │ ├── yield_df.csv
│ │ ├── wfp_food_prices_ken.csv
│ │ ├── wfp_markets_ken.csv
│ │ ├── kenya_weather_all_counties.csv
│ │ ├── Kenyas_Agricultural_Production.xlsx
│ │ └── weather_data/ …