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ets
|
| 11 |
+
pretty_name: dotcausal Dataset Loader
|
| 12 |
+
size_categories:
|
| 13 |
+
- n<1K
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# dotcausal - HuggingFace Dataset Loader
|
| 17 |
+
|
| 18 |
+
Load `.causal` binary knowledge graph files as HuggingFace Datasets.
|
| 19 |
+
|
| 20 |
+
## What is .causal?
|
| 21 |
+
|
| 22 |
+
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**.
|
| 23 |
+
|
| 24 |
+
| Technology | What it does | What's missing |
|
| 25 |
+
|------------|--------------|----------------|
|
| 26 |
+
| **SQLite** | Stores facts | No reasoning |
|
| 27 |
+
| **Vector RAG** | Finds similar text | No logic |
|
| 28 |
+
| **LLMs** | Reasons creatively | Hallucination risk |
|
| 29 |
+
| **.causal** | Stores + Reasons | **Zero hallucination** |
|
| 30 |
+
|
| 31 |
+
### Key Features
|
| 32 |
+
|
| 33 |
+
- **30-40x faster queries** than SQLite
|
| 34 |
+
- **50-200% fact amplification** through transitive chains
|
| 35 |
+
- **Zero hallucination** - pure deterministic logic
|
| 36 |
+
- **Full provenance** - trace every inference
|
| 37 |
+
|
| 38 |
+
## Installation
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
pip install datasets dotcausal
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Usage
|
| 45 |
+
|
| 46 |
+
### Load from local .causal file
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from datasets import load_dataset
|
| 50 |
+
|
| 51 |
+
# Load your .causal file
|
| 52 |
+
ds = load_dataset("chkmie/dotcausal", data_files="knowledge.causal")
|
| 53 |
+
|
| 54 |
+
print(ds["train"][0])
|
| 55 |
+
# {'trigger': 'SARS-CoV-2', 'mechanism': 'damages', 'outcome': 'mitochondria',
|
| 56 |
+
# 'confidence': 0.9, 'is_inferred': False, 'source': 'paper_A.pdf', 'provenance': []}
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### With configuration
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
# Only explicit triplets (no inferred)
|
| 63 |
+
ds = load_dataset(
|
| 64 |
+
"chkmie/dotcausal",
|
| 65 |
+
"explicit_only",
|
| 66 |
+
data_files="knowledge.causal",
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
# High confidence only (>= 0.8)
|
| 70 |
+
ds = load_dataset(
|
| 71 |
+
"chkmie/dotcausal",
|
| 72 |
+
"high_confidence",
|
| 73 |
+
data_files="knowledge.causal",
|
| 74 |
+
)
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### Multiple files / splits
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
ds = load_dataset(
|
| 81 |
+
"chkmie/dotcausal",
|
| 82 |
+
data_files={
|
| 83 |
+
"train": "train_knowledge.causal",
|
| 84 |
+
"test": "test_knowledge.causal",
|
| 85 |
+
},
|
| 86 |
+
)
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## Dataset Schema
|
| 90 |
+
|
| 91 |
+
| Field | Type | Description |
|
| 92 |
+
|-------|------|-------------|
|
| 93 |
+
| `trigger` | string | The cause/trigger entity |
|
| 94 |
+
| `mechanism` | string | The relationship type |
|
| 95 |
+
| `outcome` | string | The effect/outcome entity |
|
| 96 |
+
| `confidence` | float32 | Confidence score (0-1) |
|
| 97 |
+
| `is_inferred` | bool | Whether derived or explicit |
|
| 98 |
+
| `source` | string | Original source (e.g., paper) |
|
| 99 |
+
| `provenance` | list[string] | Source triplets for inferred facts |
|
| 100 |
+
|
| 101 |
+
## Creating .causal Files
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
from dotcausal import CausalWriter
|
| 105 |
+
|
| 106 |
+
writer = CausalWriter()
|
| 107 |
+
writer.add_triplet(
|
| 108 |
+
trigger="SARS-CoV-2",
|
| 109 |
+
mechanism="damages",
|
| 110 |
+
outcome="mitochondria",
|
| 111 |
+
confidence=0.9,
|
| 112 |
+
source="paper_A.pdf",
|
| 113 |
+
)
|
| 114 |
+
writer.save("knowledge.causal")
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
## References
|
| 118 |
+
|
| 119 |
+
- **PyPI**: https://pypi.org/project/dotcausal/
|
| 120 |
+
- **GitHub**: https://github.com/DT-Foss/dotcausal
|
| 121 |
+
- **Whitepaper**: https://doi.org/10.5281/zenodo.18326222
|
| 122 |
+
|
| 123 |
+
## Citation
|
| 124 |
+
|
| 125 |
+
```bibtex
|
| 126 |
+
@article{foss2026causal,
|
| 127 |
+
author = {Foss, David Tom},
|
| 128 |
+
title = {The .causal Format: Deterministic Inference for AI-Assisted Hypothesis Amplification},
|
| 129 |
+
journal = {Zenodo},
|
| 130 |
+
year = {2026},
|
| 131 |
+
doi = {10.5281/zenodo.18326222}
|
| 132 |
+
}
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
## License
|
| 136 |
+
|
| 137 |
+
MIT
|