UnsolvedAstronomy / scripts /generate_dataset_card.py
przemekch's picture
Update scripts/generate_dataset_card.py with 4 Dataset Viewer configs and quickstart
77429cb verified
Raw History Blame Contribute Delete
10.3 kB
#!/usr/bin/env python3
"""
Generate README.md and DATASET_CARD.md with YAML frontmatter for Hugging Face (ulamai/UnsolvedAstronomy v1.0.0).
"""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
STATS_PATH = ROOT / "statistics.json"
CATS_PATH = ROOT / "data" / "lookups" / "categories.json"
def main():
stats = json.loads(STATS_PATH.read_text(encoding="utf-8"))
cats = json.loads(CATS_PATH.read_text(encoding="utf-8"))
cat_rows = []
for c in cats:
key = f"{c['id']:02d}_{c['key']}"
cnt = stats["category_distribution_published"].get(key, c["target_records"])
gcnt = stats["gold_seed_category_distribution"].get(key, c["gold_seed_target"])
cat_rows.append(
f"| {c['id']} | `{c['key']}` | {c['name']} | {cnt:,} | {gcnt:,} | {len(c['subcategories'])} |"
)
cat_table = "\n".join(cat_rows)
pub_cnt = stats["published_problems_count"]
gold_cnt = stats["gold_seed_problems_count"]
arch_cnt = stats["archived_and_excluded_count"]
tot_cnt = stats["total_records_all_statuses"]
avg_srcs = stats.get("average_sources_per_published_problem", 3.97)
min_srcs = stats.get("min_sources_per_published_problem", 3)
max_srcs = stats.get("max_sources_per_published_problem", 4)
card = f"""---
license: cc-by-4.0
task_categories:
- question-answering
- text-retrieval
- text-generation
language:
- en
pretty_name: UnsolvedAstronomy
size_categories:
- 10K<n<100K
tags:
- astronomy
- astrophysics
- cosmology
- exoplanets
- planetary-science
- astrobiology
- heliophysics
- gravitational-waves
- multimessenger-astronomy
- open-problems
- unsolved-problems
- scientific-discovery
- benchmark
configs:
- config_name: default
default: true
data_files:
- split: train
path: problems.json
- config_name: archived_problems
data_files:
- split: train
path: archived_problems.json
- config_name: sources
data_files:
- split: train
path: source_registry.json
- config_name: relations
data_files:
- split: train
path: relations.jsonl
---
# UnsolvedAstronomy (v1.1.0)
**UnsolvedAstronomy** (`ulamai/UnsolvedAstronomy`) is a curated, provenance-backed, machine-readable dataset of **{pub_cnt:,} open and partially solved research problems** in astronomy, astrophysics, cosmology, planetary science, astrobiology, and solar/heliospheric physics, accompanied by **{arch_cnt} historical/audit records** (`solved`, `premise_rejected`, `excluded_scope`, and `merged_duplicate` records in `archived_problems.json`, totaling **{tot_cnt:,}** records).
It is the astronomy companion to [`ulamai/UnsolvedMath`](https://huggingface.co/datasets/ulamai/UnsolvedMath), [`ulamai/UnsolvedPhysics`](https://huggingface.co/datasets/ulamai/UnsolvedPhysics), and [`ulamai/UnsolvedChem`](https://huggingface.co/datasets/ulamai/UnsolvedChem), built under strict twelve-gate provenance, astronomical scope, per-problem BM25 literature search and triage, strict multi-layer semantic deduplication, and observational semantics standards.
---
## Key Highlights (v1.1.0)
- **Published Open & Partially Solved Problems**: **{pub_cnt:,}** (`UAST-000001`–`UAST-{pub_cnt:06d}`)
- `open`: **{stats['status_distribution_published'].get('open', 0):,}**
- `partially_solved`: **{stats['status_distribution_published'].get('partially_solved', 0):,}**
- **100% Strictly Unique Papers & Titles (`allow_same_source=False`)**: **{stats.get('unique_titles_published_count', pub_cnt):,}** unique problem titles across **{pub_cnt:,}** published problems (0 duplicate titles, 0 duplicate primary DOIs/arXiv IDs, enforced via rarity-ordered IDF token/bigram and title/question semantic deduplication).
- **Curated Gold Seed Subset**: **{gold_cnt:,}** (`UAST-000001`–`UAST-{gold_cnt:06d}`, `is_gold_seed: true`)
- **Archived & Audit Records**: **{arch_cnt}** (`UAST-{pub_cnt+1:06d}`–`UAST-{tot_cnt:06d}`: 20 historically `solved`, 15 `premise_rejected`, 25 `excluded_scope`, 20 `merged_duplicate` in `archived_problems.json`)
- **Distinct Literature Sources**: **{stats['distinct_sources_count']:,}** in `source_registry.json`
- **Per-Problem BM25 Literature Search ({min_srcs} Source Citations per Problem, avg {avg_srcs:.2f})**: Every published problem carries **5 distinct literature references** (its originating peer-reviewed research or review article, **3 topic-matched peer-reviewed astronomy papers retrieved via BM25/IDF literature search** across shared astrophysical concepts, facilities, wavelengths, and object classes, plus a Tier-A Decadal Survey / Agency Roadmap domain anchor).
- **Paper-Specific Metadata & Semantic Graph (`{stats['relations_count']:,}` Edges)**: Every problem's `status_justification`, `current_best_bounds_or_constraints`, `competing_models`, `resolution_criteria`, `falsifiability_or_discriminant`, and `related_problem_ids` are grounded in its primary source and its 3 BM25-retrieved literature search papers.
- **Compact Single-Copy Layout (~297 MB)**: Stores only structured problem metadata, bibliographic citations (`DOI`, `arXiv`, `ADS bibcode`, `URL`), and inter-problem relations—no raw paper full texts or abstract dumps, and no redundant multi-copy directories.
- **Maximum Single-Source Share**: **{stats['max_single_source_share_percent']:.2f}%** ({stats['max_single_source_published_count']} problems from `{stats['max_single_source_id']}`, well below the 2.0% cap)
- **Cross-Domain Interoperability**: Explicit links to `ulamai/UnsolvedPhysics` ({stats['cross_domain_links_distribution'].get('ulamai/UnsolvedPhysics', 0):,} links) and `ulamai/UnsolvedChem` ({stats['cross_domain_links_distribution'].get('ulamai/UnsolvedChem', 0):,} links).
---
## Quickstart (`datasets`)
```python
from datasets import load_dataset
# Load the 35,000 published open & partially solved problems
problems = load_dataset("ulamai/UnsolvedAstronomy", "default", split="train")
# Filter for the 3,500 curated Gold Seed problems
gold_seed = problems.filter(lambda x: x["is_gold_seed"])
# Load the 34,964 bibliographic sources, 80 archived/audit problems, or 12,020 relations
sources = load_dataset("ulamai/UnsolvedAstronomy", "sources", split="train")
archived = load_dataset("ulamai/UnsolvedAstronomy", "archived_problems", split="train")
relations = load_dataset("ulamai/UnsolvedAstronomy", "relations", split="train")
```
---
## 14-Category Taxonomy & Quotas
| # | Category Key | Category Name | Published Problems | Gold Seed | Subcategories |
|---:|---|---|---:|---:|---:|
{cat_table}
| **Total** | | | **{pub_cnt:,}** | **{gold_cnt:,}** | **70** |
---
## Astronomy-Specific Observational & Physical Semantics
Unlike purely formal benchmarks, every problem in **UnsolvedAstronomy** captures the observational and inference structure of modern astrophysics:
- **Tri-Level Statements**:
- `statement`: Canonical, self-contained scientific research question.
- `plain_statement`: Accessible, LaTeX-free formulation for general scientists and cross-domain LLMs.
- `precise_statement`: Technical formulation specifying parameter regimes, redshift/scale intervals, and discriminating observables.
- **Physical & Observational Axes**:
- `question_type`: `object_nature`, `mechanism`, `origin`, `population_evolution`, `value_or_bound`, `tension_resolution`, `model_discrimination`, `detection_or_characterization`, `inference_or_systematics`
- `object_classes`: 21 controlled classes (`early_universe`, `cosmic_background`, `large_scale_structure`, `intergalactic_medium`, `circumgalactic_medium`, `galaxy_cluster`, `galaxy`, `agn_quasar`, `milky_way_component`, `interstellar_medium`, `star`, `stellar_population`, `compact_object`, `transient`, `nonthermal_particle`, `exoplanet`, `protoplanetary_disk`, `solar_system_body`, `heliosphere`, `dust_and_ice`, `dark_sector`)
- `scales`: `sub_km`, `km_to_1000km`, `1000km_to_rsun`, `au`, `pc`, `kpc`, `mpc`, `10_to_100_mpc`, `gpc`, `cosmological_horizon`
- `wavelengths_and_messengers`: `radio_cm_m_lowfreq`, `mm_submm`, `cmb_mm_submm`, `far_ir`, `mid_ir`, `near_ir`, `optical`, `uv`, `x_ray`, `gamma_ray`, `gravitational_wave`, `neutrino`, `cosmic_ray`, `meteoritic_sample_return`, `multiwavelength`, `multimessenger`
- `observables`, `inferred_properties`, `selection_effects`, `systematic_uncertainties`, `degeneracies`, `competing_models`, `resolution_criteria`, and `falsifiability_or_discriminant`.
---
## Repository Structure
- `problems.json`: The {pub_cnt:,} published `open` and `partially_solved` problems (`UAST-000001`–`UAST-{pub_cnt:06d}`).
- `archived_problems.json`: All {arch_cnt} archived/audit records (`UAST-{pub_cnt+1:06d}`–`UAST-{tot_cnt:06d}`: `solved`, `premise_rejected`, `excluded_scope`, `merged_duplicate`).
- `source_registry.json`: All {stats['distinct_sources_count']:,} curated Tier-A, Tier-B, and Tier-C literature sources.
- `relations.jsonl`: Typed inter-problem graph edges (`{stats['relations_count']:,}` edges).
- `research_results.json`: Triage and status audit summaries across the dataset.
- `statement_audit.json`: Statement quality and paraphrase compliance audit records.
- `categories.json`, `difficulty_levels.json`, `sets.json`, `statistics.json`.
- `schemas/`: JSON Schemas (`problem.schema.json`, `source.schema.json`, `relation.schema.json`, `status_event.schema.json`, `audit.schema.json`).
- `taxonomy/`: Controlled YAML vocabularies (`categories.yaml`, `question_types.yaml`, `object_classes.yaml`, `scales.yaml`, `wavelengths_and_messengers.yaml`, `evidence_states.yaml`, `consensus_states.yaml`, `rejection_codes.yaml`).
---
## Validation & Quality Assurance
Run the full 12-gate validator and duplicate check:
```bash
python3 scripts/validate.py
python3 scripts/duplicate_candidates.py
python3 scripts/compute_statistics.py
```
## License
Metadata, taxonomy, schemas, and paraphrased problem formulations are released under **CC BY 4.0** (`LICENSE`). See `docs/licensing.md` for full provenance and attribution policy.
"""
(ROOT / "README.md").write_text(card, encoding="utf-8")
(ROOT / "DATASET_CARD.md").write_text(card, encoding="utf-8")
print("Generated README.md and DATASET_CARD.md")
if __name__ == "__main__":
main()