Skip to content

feat(notebooks): add 03_carbon_analysis carbon stock estimation notebook#47

Merged
Goldokpa merged 1 commit into
developfrom
feature/notebook-03-carbon-analysis
May 5, 2026
Merged

feat(notebooks): add 03_carbon_analysis carbon stock estimation notebook#47
Goldokpa merged 1 commit into
developfrom
feature/notebook-03-carbon-analysis

Conversation

@franchaise
Copy link
Copy Markdown
Collaborator

Summary

  • Adds notebooks/03_carbon_analysis.ipynb — end-to-end walk-through of training a BiomassRegressor, evaluating it, converting biomass to carbon and CO2e, plotting feature importances, and persisting the model + metrics.
  • Loads data/biomass/biomass_samples.parquet if present; otherwise simulates a 5,000-sample synthetic dataset so the notebook is runnable in CI.
  • Persists the trained model to models_pretrained/biomass_rf.pkl and the metrics to outputs/carbon/metrics.json for the analytics API and model-card pipeline.

Why

Sprint deliverable: "Create 03_carbon_analysis.ipynb — Carbon estimation analysis."

Test plan

  • python -c 'import json; json.load(open("notebooks/03_carbon_analysis.ipynb"))' — valid notebook JSON.
  • Notebook runs top-to-bottom on synthetic data without errors when executed via papermill notebooks/03_carbon_analysis.ipynb /tmp/out.ipynb.

Notes for reviewers

End-to-end notebook that loads (or simulates) a biomass-labelled
spectral dataset, trains a Random Forest BiomassRegressor, evaluates
RMSE/MAE/R^2/MAPE, converts biomass predictions to carbon and CO2e
using IPCC defaults, plots feature importances, and persists the
model + metrics for the analytics API and the model-card pipeline.

Falls back to a synthetic dataset when the labelled parquet file is
not present, so the notebook is runnable in CI.
Copy link
Copy Markdown
Member

@Goldokpa Goldokpa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice end-to-end demonstration — the synthetic-fallback dataset means this stays runnable in CI without GEE access. Feature importances come out where you'd expect (NDVI dominant) and the saved metrics.json plugs straight into the model-card generator.

LGTM.

@Goldokpa Goldokpa merged commit 8afc944 into develop May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants