--- license: mit task_categories: - tabular-classification tags: - finance - xbrl - distress-prediction - sec-edgar - tabular - financial-statements pretty_name: "Fin-JEPA Study 0: XBRL Financial Distress Dataset" size_categories: - 10K Features are **un-normalised** (raw USD values as reported). NaN means the > concept was not reported in the filing. See the > [feature engineering module](https://github.com/elroy-galbraith/fin-jepa/blob/main/src/fin_jepa/data/feature_engineering.py) > for ratio computation, YoY changes, winsorisation, and quantile normalisation. **Distress Labels (5)** --- nullable `Int8` (0 = no event, 1 = event, NaN = unavailable) | Column | Definition | Source | Positive Rate | |--------|-----------|--------|--------------| | `stock_decline` | Market-adjusted 252-day return < -20% | yfinance (forward returns from filing date) | 43.2% | | `earnings_restate` | Either (a) a 10-K/A-family filing (10-K/A, 10-KT/A, NT 10-K/A) within 1095 days of `period_end` in the EDGAR index, or (b) the XBRL Company Facts API reports ≥2 10-K filings for the same `(cik, period_end)`. See `earnings_restate_source` for per-row provenance. | Reconciled: EDGAR quarterly index + XBRL amendment registry | 22.3% | | `audit_qualification` | Going-concern or adverse audit opinion | External CSV (Audit Analytics) | 0.0% | | `sec_enforcement` | SEC enforcement action disclosure | EDGAR EFTS full-text search (noisy proxy) | 0.5% | | `bankruptcy` | Chapter 7/11 filing (8-K Item 1.03) | EDGAR EFTS full-text search | 0.8% | > **NaN semantics:** NaN means "data unavailable", **not** "no event". > Training code must mask NaN labels in the loss function. > > **Delisted companies:** Firms with fewer than 252 trading days of data > after their filing date are marked `delisted=True` and assigned > `stock_decline=1`. > > **`earnings_restate` reconciliation (v1.1):** The v1.0 label was a narrow > 10-K/A proxy within a 365-day window, and only ~9% of XBRL-detected > amendments carried `earnings_restate=1`. v1.1 reconciles the two signals: > the label fires if either (a) a 10-K/A-family filing (including > `NT 10-K/A` and `10-KT/A`) appears in the EDGAR index within 1095 days > of `period_end`, or (b) the XBRL Company Facts API reports multiple > 10-K filings for the same `(cik, period_end)`. The `earnings_restate_source` > column records per-row which signal fired (`edgar`, `xbrl`, `both`, or > `none`) so consumers can reproduce v1.0 by filtering to > `earnings_restate_source in ("edgar", "both")` with the narrow horizon > applied offline, or ablate by source in Study 1. This is still a proxy > — for ground truth, use Audit Analytics. > > **`audit_qualification` coverage:** This label may be all-NaN if no > external Audit Analytics data was available at build time. **Market Context (3)** | Column | Type | Description | |--------|------|-------------| | `fwd_ret_252d` | float64 | Log return over 252 trading days from filing date | | `mkt_adj_252d` | float64 | Market-adjusted return (stock - S&P 500) | | `delisted` | bool | True if < 252 trading days remain post-filing | **Audit Columns (2)** --- for diagnosing date mismatches between pipelines | Column | Type | Description | |--------|------|-------------| | `period_end_xbrl` | date | Fiscal year-end date from XBRL filing metadata (= `period_end`) | | `period_end_label` | date | Fiscal year-end date from the label/market pipeline | > The XBRL and label pipelines sometimes disagree on the canonical fiscal > year-end date by a few days (e.g. Dec 29 vs Dec 26 for companies whose > fiscal year ends on the last Saturday of December). The dataset joins on > `(cik, fiscal_year)` and uses the XBRL date as canonical `period_end`. > Rows where the two dates differ by more than 14 days are dropped as > mismatches. These audit columns let you verify alignment. ## Temporal Splits Splits are **strictly temporal** to prevent look-ahead bias: | Split | Period End Range | Rows | Purpose | |-------|-----------------|------|---------| | `train` | ≤ 2017-12-31 | 14,748 | Model training | | `validation` | 2018-01-01 to 2019-12-31 | 6,066 | Hyperparameter tuning | | `test` | 2020-01-01 to 2023-12-31 | 14,895 | Final evaluation | > The test period covers COVID-19, high-inflation, and rising-rate regimes, > testing out-of-distribution generalisation. ## Data Sources All data is derived from **public, free sources**: | Component | Source | URL | |-----------|--------|-----| | XBRL Features | SEC EDGAR Company Facts API | `https://data.sec.gov/api/xbrl/companyfacts/` | | Filing Index | SEC EDGAR Quarterly Index | `https://www.sec.gov/Archives/edgar/full-index/` | | Market Data | Yahoo Finance (via yfinance) | `https://finance.yahoo.com/` | | SEC Enforcement | EDGAR EFTS Full-Text Search | `https://efts.sec.gov/LATEST/search-index` | | Bankruptcy | EDGAR EFTS (8-K Item 1.03) | `https://efts.sec.gov/LATEST/search-index` | The universe includes **delisted, bankrupt, and acquired companies** --- there is no survivorship bias. ## Raw Files For advanced users who want the individual source tables, four parquets are available in the `raw/` directory: ```python from huggingface_hub import hf_hub_download path = hf_hub_download( repo_id="elroyg/fin-jepa-study0", repo_type="dataset", filename="raw/xbrl_features.parquet", ) ``` | File | Rows | Description | |------|------|-------------| | `raw/xbrl_features.parquet` | ~45k | 16 raw XBRL features per company-year | | `raw/label_database.parquet` | ~45k | 5 binary distress labels | | `raw/company_universe.parquet` | ~14k | Company metadata (one row per filer) | | `raw/market_aligned.parquet` | ~45k | Forward returns at 4 horizons + market benchmarks | ## Citation ```bibtex @dataset{galbraith2025finjepa, author = {Galbraith, Elroy}, title = {Fin-JEPA Study 0: XBRL Financial Distress Dataset}, year = {2025}, publisher = {Hugging Face}, url = {https://huggingface.co/datasets/elroyg/fin-jepa-study0} } ``` ## License MIT