Skip to main content

Spike-PQK

用於 SARS-CoV-2 Spike 胺基酸譜系分類的投影量子核(projected quantum kernel, PQK)專家模型。

安裝與使用

pip install quspike          # 需要 Python ≥ 3.10;依賴 torch、pennylane、scikit-learn

預訓練的 Spike-PQK(MAIN,種子 0,預設專家權重 s=0.25)已隨套件發佈,不需另外下載。

import quspike

p = quspike.predict("L452R, T478K, del69-70", k=3)     # 突變清單、序列或 FASTA 皆可
p.top_k[0].lineage, p.top_k[0].prob                    # 'B.1.617.2', 0.608
p.routing                                              # 路由群組 D/B/O 與專家是否套用

quspike.predict_sequence(spike_aa_seq)                 # 完整 / 截斷的 spike 胺基酸序列
quspike.predict_mutations(["N501Y", "E484K"], s=0)     # s=0 → 只用線性參考分類器
quspike.mutations_of(spike_aa_seq)                     # [(位置, 胺基酸)],相對 Wuhan-Hu-1
model = quspike.load_model()                           # 取得 Predictor,可重複呼叫
quspike demo                 # 開啟網頁介面(http://127.0.0.1:8000,只綁 localhost)
quspike predict --mut "L452R, T478K" --k 5
quspike info                 # 模型 metadata

模型檔位於 models/Spike-PQK/(state.pkl + meta.json),重新訓練請見 Demo/ 的 build。 自訂模型:quspike.load_model("路徑") 或環境變數 QUSPIKE_MODEL_DIR。

摘要

本文以 SARS-CoV-2 spike 胺基酸序列的 22 類 Pango 譜系分類檢驗:固定的量子特徵映射,能否提供介面相同之古典替代方案以外的判別資訊?

我們提出 Spike-PQK:

  1. 序列相對 Wuhan-Hu-1 編碼為二元突變指示向量;
  2. 線性參考分類器評分並路由至譜系群組;
  3. 對親緣相近的 Delta(D) 與 B.1 家族(B),以無可訓練參數、Trotter 化 Heisenberg 演化後的單量子位元約化密度矩陣構成 PQK;
  4. 核 SVM 專家對參考 logits 做殘差修正。

每個量子元件皆配有古典對應物,決策準則在評估前固定。

主要結果(種子 0)

資料:Data/spike-lineage/dataset_v2.tsv(31,689 條;時間切分 train 22,175/test 9,514)。

模型 Macro-F1 準確率 備註
Spike-PQK(MAIN) 0.7547 0.6893 訓練約 3.09 分鐘
線性參考分類器(C0) 0.7481 0.6847 突變指示 + 線性
RFF 古典替代(C2) 0.7552 0.6898 與 MAIN 持平
無糾纏電路(C3) 0.7544 0.6891 ΔF1 ≈ 0.0003
one-hot 邏輯迴歸 0.7339 — 古典基線
最佳影像 CNN 0.6787 — RP/GAF/MTF

結論:在此任務上 PQK 可被古典方法取代,不主張量子優勢。相對基線的領先主要來自突變指示表徵與線性參考分類器;量子元件增益(+0.0066)落在預設雜訊下限 δ=0.02 內。

方法概要

突變向量 x → 線性參考分類器 ℓ_ref → 路由至 D / B / O
                    ↓(僅 D、B)
              LDA 投影 → Heisenberg PQK → 核 SVM 專家 f_g
                    ↓
              ℓ = ℓ_ref + s · f_g(x)   (s=0 即退回參考分類器)
  • D 組:4 qubit;B 組:2 qubit;O 組不進量子路徑
  • 電路無可訓練參數;PQK 只需 O(N) 電路(非保真度核的 O(N²))
  • 對照:C0 參考、C1 高斯核、C2 RFF、C3 無耦合、C4 MLP、C5 不分群

Metadata

Release files for quspike 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quspike 0.1.0
File Size Uploaded Provenance Actions
quspike-0.1.0.tar.gz 1.9 MB Without provenance Details for quspike-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quspike 0.1.0
File Interpreter ABI Platform Actions
quspike-0.1.0-py3-none-any.whl Python 3 none any Details for quspike-0.1.0-py3-none-any.whl

Total release size: 3.8 MB

Release files / quspike-0.1.0.tar.gz

Download URL quspike-0.1.0.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
9ebb8f5791dce2db813bb3ecf64487a36ff08dbed9f9ad3b6b7129e16752d0ae
BLAKE2b-256 checksum
How to use checksums
be923ea31d960b8f968cdd79a65171dee34c35f1c6bc04b4b1c506478c2508a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / quspike-0.1.0-py3-none-any.whl

Download URL quspike-0.1.0-py3-none-any.whl
Size 1.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
26a3dad5002879bb5a0290ec8fc972dc3ec2e4767ecda5027e6df1ff54ddb46b
BLAKE2b-256 checksum
How to use checksums
cbc3be8cdbc7588667a8805f8944b2122853e4004c35a4fc5b7d941366ac2a97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for quspike 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page