KGQA-Statistics-Lab / index.html
muttsurini's picture
Initial Push
8a34897 verified
Raw History Blame Contribute Delete
20.7 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<meta name="description" content="Compute KG, QA, and joint KGQA statistics for Kinship, MQuAKE-ST, MetaQA, or your own files entirely in the browser.">
<title>KGQA Statistics Lab · THESEUS</title>
<link rel="stylesheet" href="style.css?v=11.3">
<script src="app.js?v=11.3" defer></script>
<script src="preset.js?v=11.3" defer></script>
</head>
<body>
<header class="topbar"><div class="wrap top-flex">
<a class="brand" href="#top"><span class="brand-symbol">⌘</span><span>THESEUS <small>/ KGQA STATISTICS</small></span></a>
<div class="header-links"><span class="offline-pill"><span></span> CLIENT-SIDE ANALYSIS</span><a href="https://github.com/HalcyonSolutions/THESEUS" target="_blank" rel="noopener noreferrer">Project ↗</a></div>
</div></header>
<main id="top" class="wrap">
<section class="hero">
<div class="overline">STRUCTURE MATTERS · QA MATTERS · JOINT ANALYSIS</div>
<h1>Measure the graph.<br><span>Understand the questions.</span></h1>
<p>Analyze knowledge-graph structure, QA collections, and joint KGQA navigation difficulty for Kinship, MQuAKE-ST, MetaQA, or your own files. Everything runs locally in the browser.</p>
<div class="hero-tags"><span>KG statistics</span><span>QA statistics</span><span>Random-walk calibration</span><span>Exportable reports</span></div>
</section>
<div class="workspace">
<aside class="control-column">
<section class="panel controls" aria-labelledby="source-heading">
<div class="eyebrow">SAVE / RESTORE SETUP</div>
<h2>Analysis presets</h2>
<p class="hint">Save and restore your graph and QA selections, analysis options, and metadata columns using a lightweight JSON preset. Custom file references are saved without embedding dataset contents.</p>
<label class="field-name" for="preset-name">Preset name <span class="muted">optional</span></label>
<input id="preset-name" class="preset-name" type="text" maxlength="100" placeholder="e.g. PQ filtered test run" autocomplete="off">
<div class="preset-buttons">
<button id="preset-export" class="button secondary" type="button">↓ Export preset</button>
<button id="preset-import" class="button secondary" type="button">↑ Import preset</button>
</div>
<input id="preset-import-file" class="hidden" type="file" accept=".json,application/json" aria-label="Choose a KGQA preset JSON">
<p class="hint">Presets are small JSON files containing settings and local filename or relative-path references only. They never contain the dataset files. Your browser may need permission to reconnect them.</p>
<div id="preset-missing" class="preset-missing hidden" aria-live="polite">
<strong id="preset-missing-title">Files need reconnection</strong>
<ul id="preset-missing-list"></ul>
<button id="preset-relink" class="button secondary" type="button">Select folder to reconnect</button>
<input id="preset-folder-file" class="hidden" type="file" webkitdirectory directory multiple aria-label="Choose the folder containing local dataset files">
<p class="hint">Or use the individual file selectors below. Browsers cannot automatically reopen saved local paths.</p>
</div>
<p id="preset-status" class="preset-status" role="status" aria-live="polite"></p>
<div class="divider"></div>
<div class="eyebrow">01 / KNOWLEDGE GRAPH</div>
<h2 id="source-heading">Choose a graph source</h2>
<div class="source-list" role="radiogroup" aria-label="Graph source">
<label class="source-option"><input type="radio" name="graph-source" value="kinship" checked><span class="source-copy"><b>Kinship</b><small>Family-relation KG</small></span><span class="source-tag">HF / GCS</span></label>
<label class="source-option"><input type="radio" name="graph-source" value="mquake"><span class="source-copy"><b>MQuAKE-ST</b><small>Wikidata-derived static graph</small></span><span class="source-tag">HF / GCS</span></label>
<label class="source-option"><input type="radio" name="graph-source" value="metaqa"><span class="source-copy"><b>MetaQA (encoded)</b><small>Movie KG, 1–3 hops</small></span><span class="source-tag">GCS ARCHIVE</span></label>
<label class="source-option"><input type="radio" name="graph-source" value="custom"><span class="source-copy"><b>Custom graph</b><small>Analyze your own triplet file</small></span><span class="source-tag">LOCAL FILE</span></label>
<label class="source-option"><input type="radio" name="graph-source" value="none"><span class="source-copy"><b>No graph</b><small>Skip KG and joint analysis</small></span><span class="source-tag">OFF</span></label>
</div>
<div id="builtin-provider" class="source-provider">
<label class="field-name" for="dataset-provider">Download source for built-in datasets</label>
<select id="dataset-provider"><option value="hf" selected>Hugging Face</option><option value="gcs">Google Cloud Storage (JSON API)</option></select>
<p class="hint" id="provider-hint">Choose Hugging Face or the Google Cloud Storage JSON API for built-in datasets.</p>
</div>
<p class="small muted" id="graph-source-hint">Loaded from <a href="https://huggingface.co/datasets/HalcyonSolutions/Kinship" target="_blank" rel="noopener noreferrer">HalcyonSolutions/Kinship ↗</a></p>
<div class="custom-options hidden" id="custom-graph-options">
<label class="field-name" for="triples-file">Triplets file <span class="required">required</span></label>
<input id="triples-file" type="file" accept=".txt,.tsv,.csv,text/plain,text/tab-separated-values,text/csv">
<p class="hint">Tab-delimited <code>head relation tail</code>, or CSV with optional <code>head,relation,tail</code> header.</p>
<label class="field-name" for="entities-file">Entity IDs / Node labels <span class="muted">optional</span></label>
<input id="entities-file" type="file" accept=".txt,.tsv,.csv">
<p class="hint">Upload an entity metadata CSV such as <code>EID,Title</code>, or a plain list of IDs. By default, this file provides <strong>display labels only</strong>. Unreferenced IDs are not counted as graph entities.</p>
<div id="node-column-wrap" class="hidden">
<label class="field-name" for="node-id-column">Entity ID column</label>
<select id="node-id-column"></select>
<label class="field-name" for="node-label-column">Node title column</label>
<select id="node-label-column"></select>
</div>
<label class="check-row" style="margin-top: 12px"><input id="opt-include-metadata-entities" type="checkbox"><span><strong>Include metadata-only entities (isolated nodes)</strong><small>Off by default. Enable only if the metadata file intentionally defines the full graph's node population.</small></span></label>
<label class="field-name" for="relations-file">Relation labels <span class="muted">optional</span></label>
<input id="relations-file" type="file" accept=".txt,.tsv,.csv">
<p class="hint">Supports files such as <code>Property,Title</code> or <code>RID,Title</code>. After uploading, you can confirm which columns to use.</p>
<div id="relation-column-wrap" class="hidden">
<label class="field-name" for="relation-id-column">Relation ID column</label>
<select id="relation-id-column"></select>
<label class="field-name" for="relation-label-column">Relation title column</label>
<select id="relation-label-column"></select>
</div>
<label class="field-name" for="delimiter">Graph file delimiter</label>
<select id="delimiter"><option value="auto">Auto-detect</option><option value="tab">Tab</option><option value=",">Comma</option><option value=";">Semicolon</option></select>
</div>
<div class="divider"></div>
<div class="eyebrow">02 / QA COLLECTION</div>
<h2>Choose a QA source</h2>
<div class="source-list" role="radiogroup" aria-label="QA source">
<label class="source-option"><input type="radio" name="qa-source" value="kinship"><span class="source-copy"><b>Kinship QA</b><small>Mixed-hop released collection</small></span><span class="source-tag">HF / GCS</span></label>
<label class="source-option"><input type="radio" name="qa-source" value="mquake-sa"><span class="source-copy"><b>MQuAKE-ST Single Answer</b><small>Annotated path setting</small></span><span class="source-tag">HF / GCS</span></label>
<label class="source-option"><input type="radio" name="qa-source" value="mquake-ma"><span class="source-copy"><b>MQuAKE-ST Multi Answer</b><small>Multi-answer setting</small></span><span class="source-tag">HF / GCS</span></label>
<label class="source-option"><input type="radio" name="qa-source" value="metaqa"><span class="source-copy"><b>MetaQA QA (encoded)</b><small>Mixed-hop multi-answer collection</small></span><span class="source-tag">GCS ARCHIVE</span></label>
<label class="source-option"><input type="radio" name="qa-source" value="custom"><span class="source-copy"><b>Custom QA</b><small>Analyze your own QA CSV</small></span><span class="source-tag">LOCAL FILE</span></label>
<label class="source-option"><input type="radio" name="qa-source" value="none" checked><span class="source-copy"><b>No QA</b><small>Skip QA and joint analysis</small></span><span class="source-tag">OFF</span></label>
</div>
<p class="small muted qa-compat-hint" id="qa-compat-hint" aria-live="polite">Kinship QA or No QA is available for the selected graph.</p>
<p class="small muted" id="qa-source-hint">Select a QA collection to enable QA-only and joint KGQA analysis.</p>
<div class="custom-options hidden" id="custom-qa-options">
<label class="field-name" for="qa-file">QA CSV file <span class="required">required</span></label>
<input id="qa-file" type="file" accept=".csv,.txt,text/csv,text/plain">
<p class="hint">Expected fields include <code>Question</code>, <code>Source-Entity</code>, <code>Answer-Entity</code>, <code>Hops</code>, and optional fields such as <code>SplitLabel</code>, <code>Question-Paraphrased</code>, <code>Paths</code>, or <code>Path-Key</code>.</p>
</div>
<div class="divider"></div>
<div class="eyebrow">03 / ANALYSIS OPTIONS</div>
<h2>Additional calculations</h2>
<div class="check-grid">
<label class="check-row"><input id="opt-clustering" type="checkbox"><span><strong>Clustering coefficient</strong><small>Undirected triangle clustering</small></span></label>
<label class="check-row"><input id="opt-eigen" type="checkbox"><span><strong>Eigenvector centrality</strong><small>Iterative undirected centrality</small></span></label>
<label class="check-row"><input id="opt-legacy" type="checkbox"><span><strong>Legacy path &amp; hierarchy</strong><small>Per-relation cycle-pruned paths and Krackhardt</small></span></label>
</div>
<label class="field-name" for="qa-split">QA split filter</label>
<select id="qa-split"><option value="test" selected>Test only</option><option value="all">All rows</option><option value="train">Train only</option><option value="dev">Dev only</option></select>
<label class="check-row rw-toggle"><input id="opt-run-random-walk" type="checkbox" checked><span><strong>Calculate random-walk probabilities</strong><small>Off skips fixed-horizon distributions and probability metrics, while retaining graph, QA, and non-random-walk joint summaries.</small></span></label>
<div class="check-grid rw-options">
<label class="check-row"><input id="opt-self-loops" type="checkbox" checked><span><strong>Explicit SELF_LOOP actions</strong><small>Allow each entity to remain at its current position during a random walk</small></span></label>
<label class="check-row"><input id="opt-undirected" type="checkbox"><span><strong>Undirected random walk</strong><small>Add reverse traversal actions, useful for MetaQA. Directed is the default.</small></span></label>
<label class="check-row"><input id="opt-explode-paraphrases" type="checkbox"><span><strong>Expand QA paraphrases</strong><small>Count each unique question wording as an evaluation instance when Question-Number is available</small></span></label>
</div>
<div class="rw-horizon-field"><label class="field-name" for="rw-steps">Random-walk horizon for joint analysis</label>
<select id="rw-steps"><option value="auto" selected>Auto · use maximum selected hops</option><option value="1">1 step</option><option value="2">2 steps</option><option value="3">3 steps</option><option value="4">4 steps</option><option value="5">5 steps</option><option value="6">6 steps</option></select></div>
<p class="hint">Random-walk probabilities are optional and enabled by default. With them disabled, reference-path and answer summaries remain available. Direction, self-loop, and paraphrase settings must match the reference run when comparing probabilities.</p>
<button id="analyze" type="button" class="button primary wide">Run selected analyses <span>↗</span></button>
<div class="status" id="status" role="status" aria-live="polite">Ready to analyze a graph, a QA collection, or both.</div>
<div id="progress-wrap" class="progress-wrap hidden"><div class="progress-bar"><span id="progress-inner"></span></div><span id="progress-text" class="hint">Preparing…</span></div>
<button id="cancel" class="button ghost small-button hidden" type="button">Cancel current calculation</button>
<div class="dataset-cache-panel" aria-label="Downloaded dataset cache">
<div class="dataset-cache-title">SESSION DOWNLOAD CACHE</div>
<p class="hint" id="download-cache-summary" role="status" aria-live="polite">No downloaded datasets cached yet.</p>
<div id="download-cache-list" class="download-cache-list" aria-label="Individual cached resources"></div>
<button id="clear-download-cache" class="button ghost small-button" type="button" disabled>Clear all cached datasets</button>
<p class="hint">Each downloaded GCS archive or Hugging Face file is cached separately. Delete an individual entry or clear everything. Closing or reloading this tab also clears the cache. Canceling calculations preserves completed downloads. Custom files are not copied into this cache.</p>
</div>
</section>
<section class="panel note-panel"><div class="eyebrow">METHODOLOGY</div><p>KG statistics, QA summaries, and joint navigation calibration are computed in the browser from the selected files. Joint metrics use exact random-walk probabilities over the active directed graph.</p><a href="#methods">Method details ↓</a></section>
</aside>
<div class="result-column">
<section id="empty" class="panel empty-state"><div class="empty-icon">↗</div><h2>KG, QA, and joint statistics on demand.</h2><p>Select a graph, a QA collection, or both. The report reveals graph topology, QA composition, and joint navigation difficulty measures.</p><div class="mini-diagram"><span>e₀</span><i>r₁ →</i><span>e₁</span><i>r₂ →</i><span>e₂</span></div></section>
<div id="results" class="hidden">
<section class="panel result-heading"><div><div class="eyebrow">04 / ANALYSIS REPORT</div><h2 id="report-title">Statistics summary</h2><p class="muted small" id="report-subtitle"></p></div><div class="export-actions"><button type="button" class="button secondary" id="json-export">↓ JSON</button><button type="button" class="button secondary" id="csv-export">↓ Node CSV</button></div></section>
<div class="dashboard-modes hidden" id="dashboard-modes" aria-label="Summary metric views">
<div class="dashboard-mode" id="aggregation-mode-wrap">
<label class="mode-label" for="dashboard-aggregation">Aggregation</label>
<select id="dashboard-aggregation" aria-label="Top metric aggregation"><option value="instance-micro">Instance-micro</option><option value="family-macro">Family-macro</option></select>
</div>
<div class="dashboard-mode" id="answer-mode-wrap">
<label class="mode-label" for="dashboard-answer">Answer target</label>
<select id="dashboard-answer" aria-label="Top metric answer target"><option value="Answer-Entity">Answer (released)</option><option value="Graph-Answer-Entity">Graph-Answer (graph-consistent)</option></select>
</div>
<p class="dashboard-mode-caption" id="dashboard-mode-caption"></p>
</div>
<section class="metrics-grid" id="metric-cards" aria-label="Summary metrics"></section>
<section class="panel report-body">
<div class="tabs" role="tablist" aria-label="Report views">
<button role="tab" aria-selected="true" data-tab="overview" class="tab active">KG Overview</button>
<button role="tab" aria-selected="false" data-tab="navigation" class="tab">KG Navigation</button>
<button role="tab" aria-selected="false" data-tab="qa" class="tab">QA Analysis</button>
<button role="tab" aria-selected="false" data-tab="joint" class="tab">Joint KGQA</button>
<button role="tab" aria-selected="false" data-tab="distribution" class="tab">Distributions</button>
<button role="tab" aria-selected="false" data-tab="relations" class="tab">Relations &amp; entities</button>
</div>
<div class="tab-pane" id="tab-overview" role="tabpanel"></div>
<div class="tab-pane hidden" id="tab-navigation" role="tabpanel"></div>
<div class="tab-pane hidden" id="tab-qa" role="tabpanel"></div>
<div class="tab-pane hidden" id="tab-joint" role="tabpanel"></div>
<div class="tab-pane hidden" id="tab-distribution" role="tabpanel"></div>
<div class="tab-pane hidden" id="tab-relations" role="tabpanel"></div>
</section>
</div>
</div>
</div>
<section class="method-grid" id="methods">
<div class="method-card"><div class="eyebrow">ABOUT THE STATISTICS</div><h2>Consistent definitions across KG, QA, and joint views</h2><p>Duplicate triples are counted in input rows, then removed for navigation-based degree and random-walk calculations. Weak components and density use a simple undirected projection. QA summaries report the selected rows after any split filter.</p><p>Joint analysis uses the selected graph with directed or undirected traversal actions, released source and answer entities, and reference-path annotations when available. Fixed-horizon random-walk probability evaluation is optional. Graph structural metrics always use the original triples.</p></div>
<div class="method-card"><div class="eyebrow">PRIVACY &amp; PERFORMANCE</div><h2>Your files stay in your tab</h2><p>Custom files are processed locally in a Web Worker and are not uploaded. Built-in resources are downloaded from Hugging Face or the Google Cloud Storage JSON API and cached in this tab until cleared or the page closes or reloads. Large graphs may take time and memory. Optional expensive calculations have size caps and are labeled as skipped when necessary.</p><p>When only QA is selected, KG-only tabs explain that no graph was loaded. When both are selected, the joint report combines them in a single client-side run.</p></div>
</section>
</main>
<footer class="footer"><div class="wrap footer-inner"><span>THESEUS / Knowledge Graph Navigation Research</span><div><a href="https://huggingface.co/datasets/HalcyonSolutions/Kinship" target="_blank" rel="noopener noreferrer">Kinship ↗</a><a href="https://huggingface.co/datasets/HalcyonSolutions/MQuAKE-ST" target="_blank" rel="noopener noreferrer">MQuAKE-ST ↗</a><a href="https://github.com/HalcyonSolutions/THESEUS" target="_blank" rel="noopener noreferrer">GitHub ↗</a></div></div></footer>
</body>
</html>