datamatters24 commited on
Commit
e9bd258
·
verified ·
1 Parent(s): 225534a

Upload ml/README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. ml/README.md +57 -0
ml/README.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ML Pipeline — Research Document Archive
2
+
3
+ ## Overview
4
+ Machine learning pipeline for analyzing 234K declassified government documents across 7 collections. Extracts dates, correlates documents with historical crises, classifies topics, detects redactions, and builds entity networks.
5
+
6
+ ## Prerequisites
7
+ - Python venv: `/opt/epstein_env/` (torch, spacy, transformers, sentence-transformers)
8
+ - PostgreSQL: `epstein_research` database
9
+ - RunPod: GPU-heavy tasks (zero-shot classification, BERTopic)
10
+
11
+ ## Pipeline Scripts
12
+
13
+ | Script | Purpose | Runs On | Status |
14
+ |--------|---------|---------|--------|
15
+ | `01_extract_dates.py` | Extract dates from filenames, congress sessions, NER | Hetzner CPU | Done |
16
+ | `02_seed_events.py` | Seed 20 historical events | Hetzner CPU | Done |
17
+ | `03_correlate_crises.py` | Multi-signal crisis correlation | Hetzner CPU | Done |
18
+ | `04_export_for_topics.py` | Export JSONL for GPU classification | Hetzner CPU | Done |
19
+ | `05_import_topics.py` | Import topic results from RunPod | Hetzner CPU | Ready |
20
+ | `06_extract_keywords.py` | TF-IDF keyword extraction | Hetzner CPU | TODO |
21
+ | `07_detect_redactions.py` | OpenCV redaction detection | Hetzner CPU | TODO |
22
+ | `08_find_duplicates.py` | Embedding-based dedup | Hetzner SQL | TODO |
23
+ | `09_entity_networks.py` | Co-occurrence & graph analysis | Hetzner CPU | TODO |
24
+
25
+ ## Running
26
+
27
+ ### Full pipeline (stages 1-3)
28
+ ```bash
29
+ tmux new-session -s ml-pipeline "/var/www/research/ml/run_pipeline.sh"
30
+ ```
31
+
32
+ ### Individual scripts
33
+ ```bash
34
+ cd /var/www/research/ml
35
+ /opt/epstein_env/bin/python3 01_extract_dates.py
36
+ ```
37
+
38
+ ### GPU tasks (RunPod)
39
+ Export data, transfer to RunPod, run, transfer results back:
40
+ ```bash
41
+ /opt/epstein_env/bin/python3 04_export_for_topics.py
42
+ # scp topic_export.jsonl to RunPod
43
+ # Run classify_fast.py on RunPod
44
+ # scp topic_results.jsonl back
45
+ /opt/epstein_env/bin/python3 05_import_topics.py
46
+ ```
47
+
48
+ ## Configuration
49
+ - `config.py` — DB credentials, topic labels, historical events, congress dates
50
+ - `db.py` — Database connection helpers
51
+ - `schema.sql` — Table definitions for ML pipeline
52
+
53
+ ## Results (as of 2026-03-06)
54
+ - 234K documents dated (181K from congress, 36K from folders, 9K from NER)
55
+ - 20 historical events seeded
56
+ - 296K document-event correlations
57
+ - Topic classification: processing on RunPod