557 lines
29 KiB
Markdown
557 lines
29 KiB
Markdown
# Founding-Potential Prediction — Experiments
|
||
|
||
This folder contains a self-contained, reproducible pipeline that answers two
|
||
research questions using the Dimensions researcher-metadata datasets in
|
||
[`../dimensions_data`](../dimensions_data) and [`../evaluation`](../evaluation):
|
||
|
||
- **RQ1** — *Can we classify founders vs. non-founders from full-career
|
||
researcher metadata?*
|
||
- **RQ2** — *Can we predict, from a truncated ("half") profile taken N years
|
||
before founding, whether/when a researcher will go on to found a company —
|
||
and does that signal hold up at a longer, unseen horizon and under a
|
||
time-to-event (survival) framing?*
|
||
|
||
Both baselines ("primitive" models) and modern gradient-boosting / ensemble /
|
||
deep-learning models are trained side by side so the added value of more
|
||
sophisticated modeling can be judged directly.
|
||
|
||
> **⚠️ 2026-08 redesign — read before using any RQ1/RQ2 numbers below.**
|
||
> A production probe showed the original RQ1 classifier is an
|
||
> *inverse-productivity score* (1 publication → P(founder)=0.996, 800 →
|
||
> 0.0002) and the RQ2 `p_within_3y/5y` outputs are degenerate (≡1.0 for every
|
||
> author). Root cause: the "pre-founding fix" truncates founders' totals at
|
||
> their founding year while non-founders keep full-career totals, so
|
||
> observation-window length itself encodes the label; the 0.918→0.976 ROC-AUC
|
||
> "improvement" from that fix is class-separability leakage, not noise
|
||
> removal. The corrected **symmetric landmark design** lives in
|
||
> `src/symmetric.py` (+ `src/yearly_counts.py`, `src/career_curves.py`), is
|
||
> trained by `run_rq1_symmetric.py` / `run_rq2_symmetric.py`, and reports
|
||
> honest numbers (RQ1 holdout ROC-AUC 0.874 / PR-AUC 0.726 after population +
|
||
> plausibility filtering; temporal-split PR-AUC ≈0.73; all RQ2 horizons
|
||
> discriminating at ROC-AUC 0.86–0.89). The rebuild also surfaced and filtered
|
||
> two further class-asymmetric dataset artifacts: a sampling-frame clash on
|
||
> thin profiles (founders from company databases vs non-founders from
|
||
> institutional researcher lists) and name-collision aggregate profiles
|
||
> concentrated in the non-founder class — see
|
||
> `production/classifier_symmetric/README.md`. The sections below describe the
|
||
> original (superseded) pipeline and are kept for the paper-trail.
|
||
|
||
## Environment
|
||
|
||
All work runs in a dedicated conda environment named **`potential`**.
|
||
|
||
```bash
|
||
# Recreate from scratch
|
||
conda create -n potential -c conda-forge python=3.11 pandas numpy scikit-learn \
|
||
matplotlib seaborn joblib tqdm -y
|
||
conda activate potential
|
||
pip install xgboost lightgbm catboost shap lifelines imbalanced-learn tabulate
|
||
conda install -n potential -c conda-forge pytorch -y # installed via conda, not pip
|
||
|
||
# Or reproduce the exact resolved environment:
|
||
conda env create -f environment.yml
|
||
```
|
||
|
||
> **Why PyTorch via conda and not pip?** Pip's PyTorch wheel bundles its own
|
||
> OpenMP runtime, which crashes (`OMP: Error #15 ... libomp.dylib already
|
||
> initialized`) when mixed with the conda-forge OpenMP runtime used by numpy /
|
||
> scikit-learn / LightGBM on macOS. Installing `pytorch` from `conda-forge`
|
||
> shares a single OpenMP runtime with everything else, and it works fine.
|
||
|
||
Run everything with:
|
||
|
||
```bash
|
||
cd experiments
|
||
conda run -n potential python run_rq1.py
|
||
conda run -n potential python run_rq2.py
|
||
```
|
||
|
||
> **Known benign warning**: `run_rq1.py`'s SHAP step can print a
|
||
> `mutex lock failed` abort trace *after* the pipeline has already finished
|
||
> and all result files have been written — it happens during Python
|
||
> interpreter shutdown (a threading/OpenMP teardown race between
|
||
> SHAP/LightGBM/CatBoost), not during actual computation. Check for the
|
||
> `All RQ1 results written to ...` line and the contents of `results/rq1/` to
|
||
> confirm success; ignore the trailing stack trace if that line is present.
|
||
|
||
## Repository layout
|
||
|
||
```
|
||
experiments/
|
||
environment.yml # exported conda environment (reproducibility)
|
||
src/
|
||
config.py # paths, constants, leakage-safe feature allow/deny lists
|
||
data.py # leakage-safe loaders + feature-matrix builders for RQ1/RQ2
|
||
splits.py # stratified holdout + leave-one-institution-out split helper
|
||
outliers.py # two-stage IsolationForest outlier detection
|
||
models.py # baseline + advanced/SOTA model factories, stacking ensemble
|
||
# (scale-sensitive models wrapped in StandardScaler pipelines)
|
||
tuning.py # RandomizedSearchCV hyperparameter search spaces + tune_model()
|
||
nn.py # PyTorch MLP baseline (sklearn-style wrapper)
|
||
sequence_data.py # founder-only pre-founding activity sequence dataset builder
|
||
sequence_models.py # PyTorch LSTM/Transformer sequence regressors (sklearn-style)
|
||
evaluate.py # metrics, comparison tables, plots, McNemar test, CV+CI,
|
||
# bootstrap CI, calibration curves, stratified-by-group metrics
|
||
explain.py # permutation importance + SHAP
|
||
survival.py # CoxPH time-to-event modeling for RQ2
|
||
run_rq1.py # RQ1 orchestration script
|
||
run_rq2.py # RQ2 orchestration script
|
||
run_rq1_robustness.py # ablation, CV+CI, tuning, calibration, bootstrap, area-stratified
|
||
run_sequence_founders.py # founder-only LSTM/Transformer founding-age prediction pipeline
|
||
results/
|
||
rq1/ # RQ1 tables, plots, trained model, explainability output
|
||
rq2/ # RQ2 tables, trained model, survival summary
|
||
rq1_robustness/ # ablation/CV/tuning/calibration/bootstrap/area-stratified output
|
||
sequence_founders/ # sequence-model comparison tables + plots
|
||
```
|
||
|
||
`run_rq1.py` / `run_rq2.py` add `src/` to `sys.path` at runtime rather than
|
||
relying on an installed package — simplest option for a self-contained
|
||
experiments folder that isn't meant to be pip-installed elsewhere.
|
||
|
||
## Data leakage findings (important)
|
||
|
||
While auditing `evaluation/datasets_complete` (full-career features, 161 raw
|
||
columns) before modeling, two families of columns were found to be
|
||
**identically zero for every non-founder row**, i.e. broken/undefined outside
|
||
the founder class:
|
||
|
||
1. `hist_{pub,pat,grant}_FN{+,-}{1..20}` and the no-suffix `hist_{pub,pat,grant}_FN`
|
||
columns (activity counts indexed relative to the *founding* year).
|
||
2. `{publications,patents,grants,activities}_{before,after}_founding`.
|
||
|
||
A classifier trained on the raw column set would trivially "solve" RQ1 by
|
||
detecting this artifact (non-founders always have 0 there) rather than
|
||
learning genuine founder traits. Both families are explicitly excluded via
|
||
`config.RQ1_DROP_COLUMNS` (a deny-list built and empirically verified with
|
||
`.describe()` on the raw CSVs), leaving 24 legitimate full-career numeric
|
||
aggregates (h-index, publications, patents, grants, g-index,
|
||
`industry_collab_papers`, etc.) plus 3 research-area categoricals and
|
||
`institution`.
|
||
|
||
The 3 research-area columns (`publication_research_area`,
|
||
`patent_research_area`, `grant_research_area`) originally carried 100+ specific
|
||
Dimensions codes each (e.g. `"3205 Medical Biochemistry and Metabolomics"`).
|
||
One-hot encoding them directly produced ~250 mostly-empty sparse columns, so
|
||
`data.build_rq1_matrix` first collapses each to its 2-digit broad parent code
|
||
(e.g. `"32"`) before one-hot encoding, reducing RQ1's feature matrix from 248
|
||
columns down to **99** while keeping discipline-level signal.
|
||
|
||
The original repository's non-founder downsampling used `df[:n]` — the first
|
||
N rows, not a random sample. This experiments pipeline instead either (a)
|
||
trains on the full class-imbalanced data with `class_weight='balanced'` /
|
||
`scale_pos_weight` / `auto_class_weights='Balanced'` (RQ1), or (b) uses a
|
||
documented, fixed-`random_state` 70/30 `train_test_split` to reserve a
|
||
non-founder holdout pool that is never touched during RQ2 training
|
||
(`data._nonfounder_pool_split`).
|
||
|
||
## RQ1 — Founder vs. non-founder classification
|
||
|
||
**Data**: `evaluation/datasets_complete`, 8 institutions pooled, restricted to
|
||
*pre-founding* activity only (see "Data leakage findings" above), with
|
||
multivariate outlier rows removed via a two-stage sanity-ceiling +
|
||
IsolationForest filter (`src/outliers.py`, 165/16,494 rows flagged). After
|
||
leakage-column removal: **16,494 rows, 99 features, 36.8% founders**.
|
||
|
||
**Split**: single stratified 80/20 holdout (`random_state=42`).
|
||
|
||
**Models**: `dummy_most_frequent`, `logistic_regression`, `gaussian_nb`, `knn`,
|
||
`decision_tree` (baselines); `random_forest`, `svm_rbf`, `xgboost`, `lightgbm`,
|
||
`catboost`, a `stacking_ensemble` (RF + XGBoost + LightGBM → logistic
|
||
meta-learner), and a PyTorch `torch_mlp` (advanced / SOTA-ish set). The
|
||
scale-sensitive models (`logistic_regression`, `gaussian_nb`, `knn`, `svm_rbf`)
|
||
are wrapped in a `StandardScaler` pipeline — raw features span very different
|
||
ranges (e.g. citation counts vs. binary flags), and without scaling these
|
||
models were being penalized relative to the (scale-invariant) tree ensembles.
|
||
Tree-based models are intentionally left unscaled.
|
||
|
||
### Held-out test results (`results/rq1/rq1_model_comparison.csv`)
|
||
|
||
| model | accuracy | precision | recall | f1 | roc_auc | pr_auc | mcc |
|
||
|---|---|---|---|---|---|---|---|
|
||
| lightgbm | 0.930 | 0.913 | 0.894 | 0.903 | **0.976** | **0.969** | 0.848 |
|
||
| stacking_ensemble | 0.927 | 0.897 | 0.906 | 0.901 | 0.975 | 0.968 | 0.843 |
|
||
| xgboost | 0.927 | 0.907 | 0.893 | 0.900 | 0.974 | 0.967 | 0.843 |
|
||
| catboost | 0.922 | 0.903 | 0.885 | 0.894 | 0.972 | 0.963 | 0.833 |
|
||
| torch_mlp | 0.920 | 0.898 | 0.881 | 0.890 | 0.962 | 0.955 | 0.827 |
|
||
| random_forest | 0.896 | 0.873 | 0.839 | 0.856 | 0.952 | 0.935 | 0.774 |
|
||
| logistic_regression | 0.882 | 0.824 | 0.864 | 0.843 | 0.943 | 0.928 | 0.749 |
|
||
| svm_rbf | 0.875 | 0.845 | 0.810 | 0.827 | 0.937 | 0.914 | 0.730 |
|
||
| decision_tree | 0.838 | 0.738 | 0.867 | 0.797 | 0.921 | 0.883 | 0.669 |
|
||
| knn | 0.818 | 0.816 | 0.654 | 0.726 | 0.881 | 0.821 | 0.601 |
|
||
| gaussian_nb | 0.724 | 0.806 | 0.331 | 0.469 | 0.816 | 0.721 | 0.383 |
|
||
| dummy_most_frequent | 0.632 | 0.000 | 0.000 | 0.000 | 0.500 | 0.368 | 0.000 |
|
||
|
||
Best baseline: `logistic_regression` (PR-AUC 0.928). Best overall: `lightgbm`
|
||
(PR-AUC 0.969). A McNemar test between the two
|
||
(`results/rq1/mcnemar_baseline_vs_best.csv`) gives χ²=83.8, p≈5.4e-20 — the
|
||
gain from advanced/ensembled models over the best linear baseline is
|
||
statistically significant, not noise. (These held-out numbers, and the ones
|
||
below, are corroborated by the independent 5-fold CV and bootstrap-CI results
|
||
in "Robustness & foolproofing checks" above — e.g. lightgbm's 5-fold PR-AUC
|
||
of 0.970 [0.967, 0.973] matches this single-split PR-AUC of 0.969 closely.)
|
||
|
||
### Cross-institution generalization (leave-one-institution-out)
|
||
|
||
Using the same 99-feature matrix but rebuilt **without** the institution
|
||
one-hot columns (`include_institution=False`), each of the 3 top tree-based
|
||
models is trained on 7 institutions and tested on the 8th, in turn
|
||
(`results/rq1/rq1_leave_one_institution_out.csv`). Mean across institutions:
|
||
|
||
| model | roc_auc | pr_auc | mcc |
|
||
|---|---|---|---|
|
||
| xgboost | 0.953 | 0.922 | 0.779 |
|
||
| lightgbm | 0.952 | 0.922 | 0.782 |
|
||
| random_forest | 0.940 | 0.900 | 0.738 |
|
||
|
||
Generalization to an unseen institution is nearly as strong as in-distribution
|
||
performance (compare to the ~0.97 ROC-AUC / ~0.97 PR-AUC of the pooled
|
||
holdout above) — the learned founder signal is not merely an artifact of
|
||
institution-specific quirks. `muenchen` and `toronto` are consistently the
|
||
weakest held-out institutions (ROC-AUC ~0.85), and `telaviv` the strongest
|
||
(ROC-AUC ~0.99) — see the per-institution breakdown in the CSV for the full
|
||
picture; this is likely driven by per-institution sample size and founder
|
||
rate rather than anything model-specific.
|
||
|
||
### Explainability (`results/rq1/permutation_importance.csv`, `plots/shap_summary.png`)
|
||
|
||
Top permutation-importance features on the best tree model (LightGBM), by
|
||
mean drop in PR-AUC when permuted:
|
||
|
||
1. `publications` (0.444)
|
||
2. `pub_citation_sum` (0.064)
|
||
3. `last_patent_year` (0.061)
|
||
4. `i10-index` (0.053)
|
||
5. `pub_citation_mean` (0.042)
|
||
6. `g-index` (0.036)
|
||
7. `activities_total` (0.032)
|
||
8. `pat_citation_mean` (0.024)
|
||
9. `grants` (0.015)
|
||
10. `first_publication_year` (0.013)
|
||
|
||
With the pre-founding fix applied, `publications` (pre-founding publication
|
||
count) is now overwhelmingly the dominant signal, followed by citation-impact
|
||
measures and patenting recency. This is a notably cleaner, more concentrated
|
||
importance profile than before the fix (previously the top feature accounted
|
||
for ~0.055 importance with a long, flat tail) — consistent with the ablation
|
||
finding that the pre-founding restriction sharpens rather than removes signal.
|
||
|
||
|
||
|
||
## RQ2 — Time-to-founding prediction from a truncated profile
|
||
|
||
**Data**: curated 13-column half-profile founder datasets at offsets 1/2/3
|
||
years before founding (`evaluation/datasets_halfprofiles_offset{1,2,3}`),
|
||
paired with non-founders from `datasets_complete` using the *same* curated
|
||
columns (legitimate/non-degenerate for non-founders too). Non-founders per
|
||
institution are split 70/30 once (fixed seed) into a training pool (offsets
|
||
1-3) and a holdout pool reserved exclusively for horizon-validation, so no
|
||
individual is ever seen in both training and generalization testing.
|
||
|
||
### Per-offset comparison (`results/rq2/rq2_offset_comparison.csv`)
|
||
|
||
PR-AUC by model × offset (years before founding):
|
||
|
||
| model | offset=1 | offset=2 | offset=3 |
|
||
|---|---|---|---|
|
||
| lightgbm | 0.906 | 0.908 | **0.915** |
|
||
| xgboost | 0.908 | **0.910** | 0.914 |
|
||
| random_forest | 0.905 | 0.906 | 0.910 |
|
||
| decision_tree | 0.843 | 0.844 | 0.860 |
|
||
| logistic_regression | 0.829 | 0.830 | 0.837 |
|
||
| dummy_most_frequent | 0.434 | 0.434 | 0.434 |
|
||
|
||
Predictive power increases (modestly) the closer the profile snapshot is to
|
||
the actual founding event, as expected, and gradient-boosted trees clearly
|
||
beat the linear/dummy baselines at every horizon.
|
||
|
||
### Pooled multi-horizon model + extrapolation validation
|
||
|
||
A single LightGBM model is trained on offsets 1-3 pooled (with `offset` as an
|
||
explicit feature) and evaluated on:
|
||
- its own held-out test split (in-distribution): **ROC-AUC 0.954, PR-AUC 0.947**
|
||
- `datasets_halfprofiles_validation_offset3` — an **in-range** horizon never
|
||
used for training these specific rows: **ROC-AUC 0.949, PR-AUC 0.945**
|
||
- `datasets_halfprofiles_validation_offset5` — an **extrapolation** horizon
|
||
(offset=5 was never seen during training at all): **ROC-AUC 0.942, PR-AUC 0.941**
|
||
|
||
(`results/rq2/rq2_horizon_validation.csv`.) The degradation from in-range to
|
||
extrapolation is small (ROC-AUC 0.949 → 0.942), but note the caveat: tree
|
||
ensembles cannot truly extrapolate a numeric feature (`offset`) beyond the
|
||
range seen in training, so this result should be read as "still works
|
||
reasonably at a nearby unseen horizon," not proof of extrapolation to
|
||
arbitrarily distant horizons.
|
||
|
||
### Survival analysis (CoxPH) as a complementary framing
|
||
|
||
Fixed-horizon classification requires picking specific offsets in advance.
|
||
As a principled alternative, `src/survival.py` fits a Cox proportional-hazards
|
||
model where the event is "founded a company" and the duration is years from
|
||
first publication to founding (or to last observed publication, censored, for
|
||
non-founders). Covariates are full-career aggregates (a simplification since
|
||
they are not truly time-varying — see the docstring in `survival.py` for this
|
||
known limitation).
|
||
|
||
- **Concordance index (held-out): 0.715** — the model ranks who-founds-sooner
|
||
meaningfully better than chance, but well below the classifiers above.
|
||
- **P(founds within 5y) AUC on eligible held-out rows: 0.656** (landmark
|
||
analysis avoiding immortal-time bias), versus the pooled classifier's
|
||
extrapolation ROC-AUC of 0.942 at the same horizon.
|
||
|
||
The purpose-built fixed-horizon classifier substantially outperforms CoxPH
|
||
here, most likely because: (a) the classifier gets to use the curated,
|
||
horizon-specific half-profile features directly, while CoxPH's covariates are
|
||
full-career aggregates rather than genuinely time-varying; and (b) CoxPH's
|
||
proportional-hazards assumption is a real constraint the classifiers don't
|
||
need to satisfy. The full `cph.print_summary()` (coefficients, hazard ratios,
|
||
p-values) is captured in the run log and shows `pub_citation_sum`,
|
||
`patents`/`pat_citation_sum`, and `affiliations` as the strongest positive
|
||
hazard-ratio covariates, consistent with the RQ1 permutation-importance
|
||
findings.
|
||
|
||
## Robustness & foolproofing checks (RQ1)
|
||
|
||
Beyond a single train/test split, `run_rq1_robustness.py` runs a battery of
|
||
checks aimed at making the RQ1 result trustworthy rather than a lucky split,
|
||
and at answering two specific questions: *does the pre-founding-leakage fix
|
||
actually help or hurt?* and *should the model be split up by research area?*
|
||
All numbers below come from actual executed runs; results are saved under
|
||
`results/rq1_robustness/`.
|
||
|
||
### Ablation: does the pre-founding fix help or hurt?
|
||
|
||
An earlier audit found that the raw full-career activity totals technically
|
||
include activity *after* founding (reverse causation — the model could partly
|
||
"see the future"). The fix restricts these aggregates to pre-founding
|
||
activity only. Comparing the two directly (`ablation_prefounding_fix.csv`):
|
||
|
||
| variant | n | roc_auc | pr_auc |
|
||
|---|---|---|---|
|
||
| fix ON (pre-founding only) | 16,494 | **0.976** | **0.969** |
|
||
| fix OFF (raw lifetime totals) | 16,466 | 0.918 | 0.886 |
|
||
|
||
~~The fix *improves* performance, which is counter to the naive expectation
|
||
that "removing a leak should hurt." The interpretation: the raw lifetime
|
||
totals aren't a source of illegitimately-helpful signal here so much as
|
||
*noise* — removing that dilution helps.~~
|
||
|
||
**Superseded (2026-08):** that interpretation was wrong. The +6-point jump is
|
||
the tell, not noise removal: truncating one class's observation window and not
|
||
the other's makes "small totals" a class marker, which a production probe
|
||
confirmed (P(founder) strictly decreasing in publications, at every threshold).
|
||
The honest comparison requires truncating *both* classes at a matched index
|
||
date — see the redesign note at the top and `run_rq1_symmetric.py`, which
|
||
lands at ROC-AUC ≈0.91 with a domain-plausible (hump-shaped) relationship
|
||
between output and founding probability.
|
||
|
||
### 5-fold cross-validation with 95% confidence intervals
|
||
|
||
(`cv_summary_mean.csv`; per-fold detail in `cv_<model>.csv`.)
|
||
|
||
| model | pr_auc (95% CI) | roc_auc (95% CI) |
|
||
|---|---|---|
|
||
| lightgbm | 0.970 [0.967, 0.973] | 0.978 [0.976, 0.980] |
|
||
| xgboost | 0.968 [0.965, 0.972] | 0.977 [0.974, 0.980] |
|
||
| random_forest | 0.936 [0.930, 0.942] | 0.953 [0.947, 0.958] |
|
||
| logistic_regression | 0.923 [0.917, 0.928] | 0.942 [0.936, 0.947] |
|
||
| dummy_most_frequent | 0.368 [0.368, 0.369] | 0.500 |
|
||
|
||
Tight confidence intervals across folds confirm the held-out results above
|
||
aren't an artifact of one lucky split.
|
||
|
||
### Hyperparameter tuning (RandomizedSearchCV)
|
||
|
||
(`tuning_comparison.csv`, `tuning_best_params.json`.) 20-iteration randomized
|
||
search, 3-fold CV, optimizing PR-AUC:
|
||
|
||
| model | pr_auc default → tuned | roc_auc default → tuned |
|
||
|---|---|---|
|
||
| random_forest | 0.935 → **0.953** | 0.952 → 0.965 |
|
||
| xgboost | 0.967 → **0.971** | 0.974 → 0.978 |
|
||
| lightgbm | 0.969 → **0.971** | 0.976 → 0.978 |
|
||
|
||
Tuning gives a modest but consistent lift for every model, largest for
|
||
random_forest. The tuned LightGBM is used as the reference model for the
|
||
calibration and bootstrap analyses below.
|
||
|
||
### Calibration (`plots/calibration.png`)
|
||
|
||
Reliability diagrams (predicted probability vs. observed founder rate, in
|
||
quantile bins) for logistic regression and both default/tuned LightGBM all
|
||
track close to the diagonal — the model's probability outputs are
|
||
meaningfully interpretable as probabilities, not just a ranking score.
|
||
LightGBM is slightly better calibrated than logistic regression in the
|
||
low-probability region.
|
||
|
||
### Bootstrap confidence intervals (tuned LightGBM, 1000 resamples)
|
||
|
||
(`bootstrap_ci.csv`.) Percentile bootstrap on the held-out test set:
|
||
|
||
| metric | estimate | 95% CI |
|
||
|---|---|---|
|
||
| accuracy | 0.937 | [0.929, 0.945] |
|
||
| precision | 0.926 | [0.911, 0.941] |
|
||
| recall | 0.900 | [0.883, 0.916] |
|
||
| f1 | 0.913 | [0.901, 0.924] |
|
||
| roc_auc | 0.978 | [0.973, 0.982] |
|
||
| pr_auc | 0.971 | [0.965, 0.976] |
|
||
| mcc | 0.863 | [0.845, 0.881] |
|
||
|
||
### Does research area affect the results? (stratified evaluation + per-area specialists)
|
||
|
||
This was a specific concern raised: founders in different research areas
|
||
might look systematically different, and pooling everyone together could hide
|
||
or distort area-specific effects. Two checks were run.
|
||
|
||
**1. Stratified evaluation** — the pooled tuned model's held-out predictions
|
||
were broken out by broad (2-digit) research area (`area_stratified_pooled_model.csv`,
|
||
22 groups, N from 7 to 1,166). The model performs well **uniformly** across
|
||
areas — no area catastrophically fails. Largest groups: area "32" (N=1,166)
|
||
roc_auc=0.967/pr_auc=0.936; area "31" (N=377) roc_auc=0.973/pr_auc=0.936; area
|
||
"40" (N=244) roc_auc=0.962/pr_auc=0.964. Smaller areas (N<100) show more
|
||
variance (expected from smaller sample sizes) but generally still PR-AUC
|
||
0.91-1.0.
|
||
|
||
**2. Per-area specialist vs. pooled model** — for each of the 7 largest
|
||
research areas (N≥500), a dedicated model trained *only* on that area's data
|
||
was compared against the pooled model evaluated on the same area's subset
|
||
(`per_area_specialist_vs_pooled.csv`):
|
||
|
||
| area | N (specialist train) | specialist pr_auc | pooled pr_auc |
|
||
|---|---|---|---|
|
||
| 32 | 4,721 | 0.929 | **0.936** |
|
||
| 40 | 1,847 | 0.933 | **0.964** |
|
||
| 51 | 1,012 | 0.848 | **0.941** |
|
||
| 34 | 462 | 0.909 | **0.965** |
|
||
|
||
**The pooled model beats the dedicated specialist on every single area
|
||
tested.** Splitting the model by research area hurts performance — the loss
|
||
of training data per specialist (hundreds to a few thousand rows, vs. ~13k
|
||
for the pooled model) outweighs any benefit from area-specific
|
||
specialization. **Conclusion: keep research area as a pooled feature, don't
|
||
split the model by area.**
|
||
|
||
## Sequence modeling — can a transformer predict *when* someone will found a company?
|
||
|
||
The activity-count aggregates used in RQ1/RQ2 discard *order* — e.g. two
|
||
founders with the same total pre-founding publication count look identical
|
||
even if one had a burst of activity right before founding and the other had
|
||
a burst 15 years earlier. To test whether sequence order carries additional
|
||
signal, `run_sequence_founders.py` builds true year-by-year sequences and
|
||
compares an LSTM and a Transformer against simpler baselines on the task of
|
||
predicting **founding_age** (years from first publication to founding) from
|
||
the preceding 20-year window of publication/patent/grant activity.
|
||
|
||
### Data construction and a data-quality fix
|
||
|
||
`founding_age = founded_on − first_publication_year` computed naively across
|
||
all 6,158 founders gave an absurd range (**−2,022 to +2,022**), revealing
|
||
that a meaningful subset of founders have sentinel/placeholder year values
|
||
(not just non-founders, as previously found). Fix: restrict to founders where
|
||
*both* `founded_on` and `first_publication_year` fall in a plausible
|
||
`[1950, 2024]` range (drops 1,741/6,158 implausible founders → 4,417 remain),
|
||
then further restrict to `founding_age` in `[1, 20]` since the 20-year
|
||
lookback window structurally can't resolve longer careers — this is a
|
||
deliberate, documented scoping decision, not a hidden limitation. **2,298
|
||
founders** remain for the sequence task (`src/sequence_data.py`).
|
||
|
||
### Results (`results/sequence_founders/`)
|
||
|
||
| model | mae | rmse | r2 |
|
||
|---|---|---|---|
|
||
| transformer | **0.180** | 0.269 | 0.998 |
|
||
| lstm | 0.208 | **0.258** | 0.998 |
|
||
| naive_first_activity (heuristic) | 0.554 | 1.885 | 0.888 |
|
||
| aggregate_rf (summary stats, no order) | 2.571 | 3.424 | 0.630 |
|
||
|
||
(`naive_first_activity` is a zero-parameter heuristic: founding_age is
|
||
inferred purely from how many leading zero-activity years precede the first
|
||
nonzero year. `aggregate_rf` is a random forest on 9 summary features — total,
|
||
nonzero-year count, and last-3-years sum per channel — deliberately
|
||
*discarding* order, to isolate the value of order/position information.)
|
||
|
||
**Honest interpretation**: the task has strong structural determinism — even
|
||
the naive heuristic gets R²=0.888 just by counting leading zero years, so
|
||
this isn't a "hard AI problem" in the sense of needing deep learning to make
|
||
it tractable at all. The meaningful findings are: (1) the LSTM/Transformer
|
||
are far more **robust** than the brittle heuristic (~3x lower MAE, 0.55 → 0.18–0.21
|
||
— the heuristic breaks badly on a single spurious early activity blip, the
|
||
sequence models don't), and (2) sequence models vastly outperform the
|
||
non-positional aggregate-stats baseline (R² 0.63 → 0.998), proving that
|
||
**order/position information, not just totals, is what the extra modeling
|
||
power is capturing.** This is reported as a robustness/precision gain over
|
||
simpler methods, not an overclaimed "novel predictive capability."
|
||
|
||
### Why there's no founder-vs-non-founder sequence classifier
|
||
|
||
The natural next step — building comparable sequences for non-founders too,
|
||
to train a founder-vs-non-founder *sequence* classifier (a more direct test
|
||
of the "sequential transformer" idea) — was investigated and found **not
|
||
feasible with the data available in this workspace**, for two independent,
|
||
confirmed reasons:
|
||
|
||
1. Non-founders' `hist_{pub,pat,grant}_FN[+-]N` columns in
|
||
`evaluation/datasets_complete` are computed by
|
||
`extraction/non_founders_scripts.ipynb`'s `generate_history(...,
|
||
nonstartup=True)`, which hardcodes `founded_year = 0` for non-founders —
|
||
these columns are anchored at literal calendar year 0 and are **entirely
|
||
zero** (verified via `.sum()==0` / `.max()==0` across every non-founder row).
|
||
They were never usable for this and are correctly excluded from
|
||
`config.RQ1_NUMERIC_COLUMNS` already (no leakage risk in the existing RQ1
|
||
model).
|
||
2. As a fallback, the raw `dimensions_data/{institution}_papers.csv` files
|
||
were checked directly for a possible reconstruction path. These files
|
||
turn out to contain **only founders' publication records** — verified on
|
||
Stanford by matching tracked researcher names against the raw file's
|
||
`author_people` column: **85.8%** of founders (1,580/1,842) match, versus
|
||
**0%** of non-founders (0/2,482). No raw non-founder paper/patent pull
|
||
files exist anywhere in the workspace (only pre-aggregated
|
||
`*_nonfounders_features_dataset.csv` summaries) — the underlying raw data
|
||
would need to be re-collected from the Dimensions API, which is out of
|
||
scope here.
|
||
|
||
Given this, the founder-only founding-age sequence model above is the
|
||
deliverable for the "sequential transformer" investigation. Building a
|
||
founder-vs-non-founder sequence classifier would require re-querying the
|
||
Dimensions API for non-founders' raw, per-year publication/patent history.
|
||
|
||
(Side note for any future data-collection work: `dimensions_data/*_papers.csv`
|
||
already has a pre-matched flat `author_people` name column + numeric `year`
|
||
column, exploded to one row per paper per tracked founder — reconstructing a
|
||
person's per-year totals is a simple `groupby(["author_people","year"]).size()`
|
||
away, no need to fuzzy-match the nested `authors` JSON-like list yourself.
|
||
Loading just `usecols=["author_people","year"]` is fast — about 10s even for
|
||
a 4.4GB/600K-row file — and reproduces `datasets_complete`'s `publications`
|
||
totals almost exactly, 98.1% exact match, correlation 0.99999997, for the
|
||
founders whose names do match.)
|
||
|
||
## Answering the research questions
|
||
|
||
- **RQ1**: Yes. LightGBM classifies founders vs. non-founders with ROC-AUC
|
||
0.976 / PR-AUC 0.969 on held-out data, a statistically significant
|
||
improvement (McNemar p≈5.4e-20) over the best simple baseline (logistic
|
||
regression, ROC-AUC 0.943), and generalizes well to institutions unseen
|
||
during training (mean ROC-AUC 0.95 under leave-one-institution-out).
|
||
- **RQ2**: Yes, with caveats. Gradient-boosted models predict founding within
|
||
a 1-3 year horizon from truncated profiles with ROC-AUC ≈ 0.91-0.92, and a
|
||
pooled multi-horizon model still achieves ROC-AUC 0.94 at a 5-year horizon
|
||
it never trained on directly (small degradation vs. 0.95 in-distribution).
|
||
A CoxPH survival model provides a complementary, assumption-explicit
|
||
time-to-event view but underperforms the direct classifier (concordance
|
||
0.715, 5-year AUC 0.656), which is expected given it uses less
|
||
horizon-specific information.
|
||
- **Is this robust, or a lucky split?** The RQ1 result holds up under 5-fold
|
||
CV (tight 95% CIs), bootstrap resampling, hyperparameter tuning, and
|
||
calibration checks — see "Robustness & foolproofing checks" above. The
|
||
pre-founding leakage fix specifically *improves* performance rather than
|
||
degrading it (0.976 vs 0.918 ROC-AUC), and the model performs uniformly
|
||
well across all 22 research-area groups, with a pooled model beating
|
||
every dedicated per-area specialist tested.
|
||
- **Does sequence order (not just totals) matter?** Yes. LSTM/Transformer
|
||
models predicting founding_age from ordered 20-year activity sequences
|
||
achieve R²=0.998, versus R²=0.63 for an equivalent non-positional
|
||
aggregate-stats model — see "Sequence modeling" above. A comparable
|
||
founder-vs-non-founder sequence classifier was investigated but found
|
||
infeasible with data available in this workspace (non-founders lack any
|
||
usable raw or pre-aggregated sequence data).
|