fin-jepa-study0 / README.md
elroyg's picture
Upload folder using huggingface_hub
9770f3c verified
|
Raw History Blame Contribute Delete
11.4 kB
metadata
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<n<100K
language:
  - en
configs:
  - config_name: default
    data_files:
      - split: train
        path: default/train.parquet
      - split: validation
        path: default/validation.parquet
      - split: test
        path: default/test.parquet
    default: true
dataset_info:
  - config_name: default
    features:
      - name: cik
        dtype: string
      - name: ticker
        dtype: string
      - name: fiscal_year
        dtype: int64
      - name: period_end
        dtype: date32
      - name: filed_date
        dtype: date32
      - name: sector
        dtype: string
      - name: sic_code
        dtype: string
      - name: total_assets
        dtype: float64
      - name: total_liabilities
        dtype: float64
      - name: total_equity
        dtype: float64
      - name: current_assets
        dtype: float64
      - name: current_liabilities
        dtype: float64
      - name: retained_earnings
        dtype: float64
      - name: cash_equivalents
        dtype: float64
      - name: total_debt
        dtype: float64
      - name: total_revenue
        dtype: float64
      - name: cost_of_sales
        dtype: float64
      - name: operating_income
        dtype: float64
      - name: net_income
        dtype: float64
      - name: interest_expense
        dtype: float64
      - name: cash_from_operations
        dtype: float64
      - name: cash_from_investing
        dtype: float64
      - name: cash_from_financing
        dtype: float64
      - name: stock_decline
        dtype: int8
      - name: earnings_restate
        dtype: int8
      - name: audit_qualification
        dtype: int8
      - name: sec_enforcement
        dtype: int8
      - name: bankruptcy
        dtype: int8
      - name: earnings_restate_source
        dtype: string
      - name: fwd_ret_252d
        dtype: float64
      - name: mkt_adj_252d
        dtype: float64
      - name: delisted
        dtype: bool
      - name: period_end_xbrl
        dtype: date32
      - name: period_end_label
        dtype: date32
    splits:
      - name: train
        num_examples: 14748
      - name: validation
        num_examples: 6066
      - name: test
        num_examples: 14895

Fin-JEPA Study 0: XBRL Financial Distress Dataset

A tabular dataset of 35,709 company-year observations for 4,520 unique SEC filers (2012--2023), linking XBRL financial statement features extracted from 10-K filings to five binary distress outcomes. Built for the first gate of the Financial JEPA project.

Quick Start

from datasets import load_dataset

ds = load_dataset("elroyg/fin-jepa-study0")
print(ds)
# DatasetDict({
#     train: Dataset(num_rows=14748, ...),
#     validation: Dataset(num_rows=6066, ...),
#     test: Dataset(num_rows=14895, ...),
# })

train = ds["train"].to_pandas()
print(train.columns.tolist())

Dataset Structure

Configs

Config Description Files
default Merged features + labels, temporally split default/{train,validation,test}.parquet
(raw files) Individual source parquets for advanced use raw/*.parquet (see below)

Columns (34 total, including 2 audit columns)

Identifiers / Metadata (7)

Column Type Description
cik string SEC Central Index Key (10-digit, zero-padded)
ticker string Equity ticker symbol (nullable)
fiscal_year int64 Fiscal year of the 10-K filing
period_end date Fiscal year-end date
filed_date date Date the 10-K was filed with the SEC
sector string Fama-French 12-industry sector
sic_code string 4-digit SIC code (nullable)

XBRL Financial Features (16) --- all float64, sourced from SEC EDGAR Company Facts API

Column Statement XBRL Concept(s)
total_assets Balance Sheet Assets
total_liabilities Balance Sheet Liabilities
total_equity Balance Sheet StockholdersEquity (+fallback)
current_assets Balance Sheet AssetsCurrent
current_liabilities Balance Sheet LiabilitiesCurrent
retained_earnings Balance Sheet RetainedEarningsAccumulatedDeficit
cash_equivalents Balance Sheet CashAndCashEquivalentsAtCarryingValue (+fallbacks)
total_debt Balance Sheet Computed: LongTermDebt + ShortTermBorrowings
total_revenue Income Revenues (+fallbacks)
cost_of_sales Income CostOfGoodsSold (+fallbacks)
operating_income Income OperatingIncomeLoss
net_income Income NetIncomeLoss (+fallbacks)
interest_expense Income InterestExpense (+fallback)
cash_from_operations Cash Flow NetCashProvidedByUsedInOperatingActivities (+fallback)
cash_from_investing Cash Flow NetCashProvidedByUsedInInvestingActivities (+fallback)
cash_from_financing Cash Flow NetCashProvidedByUsedInFinancingActivities (+fallback)

Features are un-normalised (raw USD values as reported). NaN means the concept was not reported in the filing. See the feature engineering module 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:

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

@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