|
|
--- |
|
|
license: mit |
|
|
language: |
|
|
- en |
|
|
tags: |
|
|
- knowledge-graph |
|
|
- causal-inference |
|
|
- rag |
|
|
- zero-hallucination |
|
|
- triplets |
|
|
pretty_name: dotcausal Dataset Loader |
|
|
size_categories: |
|
|
- n<1K |
|
|
--- |
|
|
|
|
|
# dotcausal - HuggingFace Dataset Loader |
|
|
|
|
|
Load `.causal` binary knowledge graph files as HuggingFace Datasets. |
|
|
|
|
|
## What is .causal? |
|
|
|
|
|
The `.causal` format is a binary knowledge graph with **embedded deterministic inference**. It solves the fundamental problem of AI-assisted discovery: **LLMs hallucinate, databases don't reason**. |
|
|
|
|
|
| Technology | What it does | What's missing | |
|
|
|------------|--------------|----------------| |
|
|
| **SQLite** | Stores facts | No reasoning | |
|
|
| **Vector RAG** | Finds similar text | No logic | |
|
|
| **LLMs** | Reasons creatively | Hallucination risk | |
|
|
| **.causal** | Stores + Reasons | **Zero hallucination** | |
|
|
|
|
|
### Key Features |
|
|
|
|
|
- **30-40x faster queries** than SQLite |
|
|
- **50-200% fact amplification** through transitive chains |
|
|
- **Zero hallucination** - pure deterministic logic |
|
|
- **Full provenance** - trace every inference |
|
|
|
|
|
## Installation |
|
|
|
|
|
```bash |
|
|
pip install datasets dotcausal |
|
|
``` |
|
|
|
|
|
## Usage |
|
|
|
|
|
### Load from local .causal file |
|
|
|
|
|
```python |
|
|
from datasets import load_dataset |
|
|
|
|
|
# Load your .causal file |
|
|
ds = load_dataset("chkmie/dotcausal", data_files="knowledge.causal") |
|
|
|
|
|
print(ds["train"][0]) |
|
|
# {'trigger': 'SARS-CoV-2', 'mechanism': 'damages', 'outcome': 'mitochondria', |
|
|
# 'confidence': 0.9, 'is_inferred': False, 'source': 'paper_A.pdf', 'provenance': []} |
|
|
``` |
|
|
|
|
|
### With configuration |
|
|
|
|
|
```python |
|
|
# Only explicit triplets (no inferred) |
|
|
ds = load_dataset( |
|
|
"chkmie/dotcausal", |
|
|
"explicit_only", |
|
|
data_files="knowledge.causal", |
|
|
) |
|
|
|
|
|
# High confidence only (>= 0.8) |
|
|
ds = load_dataset( |
|
|
"chkmie/dotcausal", |
|
|
"high_confidence", |
|
|
data_files="knowledge.causal", |
|
|
) |
|
|
``` |
|
|
|
|
|
### Multiple files / splits |
|
|
|
|
|
```python |
|
|
ds = load_dataset( |
|
|
"chkmie/dotcausal", |
|
|
data_files={ |
|
|
"train": "train_knowledge.causal", |
|
|
"test": "test_knowledge.causal", |
|
|
}, |
|
|
) |
|
|
``` |
|
|
|
|
|
## Dataset Schema |
|
|
|
|
|
| Field | Type | Description | |
|
|
|-------|------|-------------| |
|
|
| `trigger` | string | The cause/trigger entity | |
|
|
| `mechanism` | string | The relationship type | |
|
|
| `outcome` | string | The effect/outcome entity | |
|
|
| `confidence` | float32 | Confidence score (0-1) | |
|
|
| `is_inferred` | bool | Whether derived or explicit | |
|
|
| `source` | string | Original source (e.g., paper) | |
|
|
| `provenance` | list[string] | Source triplets for inferred facts | |
|
|
|
|
|
## Creating .causal Files |
|
|
|
|
|
```python |
|
|
from dotcausal import CausalWriter |
|
|
|
|
|
writer = CausalWriter() |
|
|
writer.add_triplet( |
|
|
trigger="SARS-CoV-2", |
|
|
mechanism="damages", |
|
|
outcome="mitochondria", |
|
|
confidence=0.9, |
|
|
source="paper_A.pdf", |
|
|
) |
|
|
writer.save("knowledge.causal") |
|
|
``` |
|
|
|
|
|
## References |
|
|
|
|
|
- **PyPI**: https://pypi.org/project/dotcausal/ |
|
|
- **GitHub**: https://github.com/DT-Foss/dotcausal |
|
|
- **Whitepaper**: https://doi.org/10.5281/zenodo.18326222 |
|
|
|
|
|
## Citation |
|
|
|
|
|
```bibtex |
|
|
@article{foss2026causal, |
|
|
author = {Foss, David Tom}, |
|
|
title = {The .causal Format: Deterministic Inference for AI-Assisted Hypothesis Amplification}, |
|
|
journal = {Zenodo}, |
|
|
year = {2026}, |
|
|
doi = {10.5281/zenodo.18326222} |
|
|
} |
|
|
``` |
|
|
|
|
|
## License |
|
|
|
|
|
MIT |
|
|
|