Instructions to use imaflower/dienbien-rice-yield with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use imaflower/dienbien-rice-yield with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("imaflower/dienbien-rice-yield", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Rice Yield Forecasting Model — Điện Biên, Vietnam
Predicts rice yield (tons/hectare) for districts in Điện Biên province, NW Vietnam, from growing-season weather features (rainfall timing by phenological stage, frost/cold days, growing degree days, elevation).
Part of a broader yield forecasting & harvest planning pipeline (weather ingestion → feature engineering → model → harvest-window + risk alerts).
Model details
- Algorithm: Random Forest
- Format: skops (
model.skops) — safe to load without pickle's arbitrary-code-execution risk - Cross-validated MAE: 0.209 t/ha (5-fold CV)
- Cross-validated R²: 0.246
- Training samples: 80 (district-year observations)
- Trained: 2026-07-18
⚠️ Important: this model was trained on synthetic, domain-informed weather+yield data, not real measured yield records (see the parent repo's README for why, and how to retrain on real GSO/ICO data). Treat predictions as illustrative until retrained on real district-level yield history.
Input features
flowering_rain_mm
season_rain_mm
flood_risk_rain_mm
flowering_mean_temp_c
cold_days_flowering
growing_degree_days
mean_sunshine_ripening
elevation_m
season_rain_cv
All features are derived from daily weather (tmax_c, tmin_c, tmean_c, precip_mm, et0_mm, sunshine_hours) aggregated over crop-specific
phenological windows — see features.py in the parent repo for exact
definitions (e.g. flowering_rain_mm = total rainfall during the
flowering month(s), frost_days_sensitive = count of nights below the
frost threshold during frost-sensitive months).
Usage
from huggingface_hub import hf_hub_download
import skops.io as sio
import pandas as pd
model_path = hf_hub_download(repo_id="imaflower/dienbien-rice-yield", filename="model.skops")
model = sio.load(model_path, trusted=sio.get_untrusted_types(file=model_path))
X = pd.DataFrame([{
"flowering_rain_mm": 150, "season_rain_mm": 1100, "flood_risk_rain_mm": 500,
"flowering_mean_temp_c": 24.0, "cold_days_flowering": 0, "growing_degree_days": 3800,
"mean_sunshine_ripening": 6.5, "elevation_m": 480, "season_rain_cv": 1.5
}])
predicted_yield_t_ha = model.predict(X)[0]
Intended use & limitations
- Scoped to Điện Biên province district-level, seasonal (annual) yield forecasting — not validated for other provinces/climates without retraining.
- Does not account for management practices (fertilization, pest control,
variety-specific agronomy beyond the multiplier applied in the parent
pipeline's
predict.py). - Synthetic training data encodes plausible agronomic relationships but is not a substitute for real yield statistics.
- Downloads last month
- -