Skip to content
Menu

Look

Language

GitHub — @IchiSieben
Projects

Predictor de Ingresos e Informalidad

Live usable

I compared 9 model specifications to predict labor income and informality risk in Peru, from the ENAHO household survey.

Estimates labor income and the probability of informal employment in Peru using ENAHO 2025 microdata. Compares nine specifications and shows the whole path, not just the winning model.

2 min read Live demo (may take ~1 min to wake) → Free-tier Streamlit apps sleep when idle; the first visitor wakes them, which can take about a minute. Code →

Technology

  • Machine learning
  • Data viz

Sector

  • Economics & finance
  • Public sector

Problem

Public conversation about informal labor in Peru argues from anecdote. ENAHO microdata already exists, but almost nobody outside academia turns it into a number a policymaker or a curious visitor can actually use, or shows the tradeoff between a model that explains and one that only predicts.

Approach

A model tournament (OLS, Mincer, Lasso, RF, GB) plus an informality classifier — built to show the whole path, not just the model that won.

Nine income specifications run under the same 80/20 split and 5-fold cross-validation, from a literal reading of a classroom Mincer equation up to gradient boosting on log income, selected by cross-validated MAE rather than by peeking at the test set. The deployed model (E9, gradient boosting) beats the best interpretable specification by S/79 of MAE — a gap read as the contribution of nonlinearities and interactions a linear form can’t capture, not as proof the simple model is wrong. No specification’s R² clears 0.5 in soles, which the README frames against Mincer’s own textbook R² of 0.25-0.35 in log income — a different scale, cited so the number isn’t mistaken for a stronger fit than it is.

A second, separately trained classifier estimates informal-employment risk from the same microdata: gradient boosting reaches 0.96 PR-AUC against a 0.68 prevalence baseline, with an operating point chosen on out-of-fold training probabilities (never test) so that, of every 1,000 workers flagged, roughly 900 are genuinely informal. A structural ablation is reported alongside it — removing firm size alone drops PR-AUC to 0.957 — precisely so the score isn’t read as more than what it is: a targeting tool for programs, not a forecast of anyone’s future employment status.

Result

MAE, deployed income model (S/)
610.8S/

reports/torneo_regresion.md

PR-AUC, informality classifier (test)
0.961

reports/clasificador_informalidad.md

specifications compared
9

README.md

Standards

Software quality (ISO/IEC 25010) Addressed through the tournament itself rather than a formal ISO/IEC 25010 pass: 9 specifications compared under the same 80/20 split and 5-fold CV, plus an ablation study on the classifier (README §2-3).
Web performance (Core Web Vitals) not measured
Accessibility (WCAG 2.2) not measured
Research software (FAIR4RS) partial — data source (INEI ENAHO 2025) is cited and code is public, but the analysis itself has no DOI or citation file
Security hygiene not measured
Reproducibility Pinned dependencies; the same 80/20 split and 5-fold CV are reused across all 9 specifications so results are comparable, not just individually reproducible.
Benchmark methodology Cross-validated benchmark with a stated protocol (5-fold CV, one fixed split, model selection by CV metric before ever touching test) — README §2, confirmed on the held-out test set.
Data / model documentation Present: per-model metrics tables (MAE, R², PR-AUC, Brier), an operating-point tradeoff table, and a structural ablation on the classifier (README §2-3).
Versioning & change log Apache-2.0 licensed code and models (LICENSE), CC BY-NC 4.0 documentation; no CHANGELOG.

What I'd do next

  • Ship the standalone HTML page at /predictor-ingresos/ with the ?embed=true iframe (frozen this pass — see the front matter note).
  • Retest the Streamlit cold-start after >12h idle and add the honest wake-time label if it still sleeps.
  • Publish the explanatory model's weighted coefficients (education, gender, firm size) as a second, readable view next to the predictive one.