Skip to main content

orange-pca-addon — PCA Weller (Chemometrie-PCA für Orange3)

Autor: Philipp Weller (AK Weller) · philipp.weller@googlemail.com

Erweitertes PCA-Widget für Orange3 mit Fokus auf chemometrische Anwendungen (NMR, Spektroskopie, Biomarker). Ziel: mehr Kontrolle über Preprocessing und Ausreißer als das eingebaute Orange-PCA-Widget.

🎯 Was es zusätzlich zum regulären PCA-Widget kann

Feature Details
Preprocessing auto (Autoscaling), pareto, center, none — wählbar vor dem Fit
Komponenten-Wahl Kaiser-Kriterium (automatisch) oder erklärte-Varianz-Schwellwert oder feste Anzahl
Varianz % an den Achsen Score-Plot-Achsen zeigen PC1 (72.8%), PC2 (23.0%) usw.
T²/Q-Ausreißer-Diagnostik Hotelling-T²- und Q-Restdual-Plot mit statistischen Kontrollgrenzen
Ausreißer entfernen Button filtert Samples jenseits der Limits und refittet das Modell auf den Inliers
Scores-Plot Klassen-Farbcodierung, Punktgröße optional proportional zum Q-Restdual

📐 Statistik

  • Hotelling-T² pro Sample: T2_i = Σ_k t_ik² / λ_k, Kontrollgrenze via F-Verteilung (Nomikos & MacGregor): T2_lim = k·(n−1)/(n−k) · F(α, k, n−k).
  • Q-Residual pro Sample: Quadratsumme des Rekonstruktionsfehlers. Kontrollgrenze über momentbasierte skalierte χ²-Näherung (g · χ²(df)).
  • Kaiser-Kriterium (Kaiser 1960): behalte Komponenten, deren Eigenwert den Mittelwert der Eigenwerte übersteigt (= bei Autoscaling: Eigenwert > 1).

📦 Installation

Teil des WellerLab-Monorepos (github.com/philippweller/WellerLab). Mit dem gemeinsamen Installer (Oranges eigenes Python wird automatisch gefunden):

# Installer holen (einmalig):
curl -fsSL https://raw.githubusercontent.com/philippweller/WellerLab/main/orange-install.py -o orange-install.py
# PCA Weller installieren:
python3 orange-install.py pca

Manuell per pip-subdirectory-Spezifikation:

/Applications/Orange.app/Contents/Frameworks/Python.framework/Versions/Current/bin/python3.12 \
  -m pip install "git+https://github.com/philippweller/WellerLab.git@main#subdirectory=orange-pca-addon"

Orange beenden (Cmd/Ctrl+Q) und neu starten → Widget unter PCA Weller suchen.

🧭 Bedienung (im Widget)

  1. Preprocessing–Scaling wählen (Standard: auto).
  2. Komponenten-Methode wählen:
    • Kaiser criterion (automatic) — Anzahl automatisch
    • Explained variance fraction — bis kumulative Varianz ≥ Schwellwert
    • Fixed number — feste Komponentenzahl
  3. Score-Plot prüfen (Varianz % an den Achsen, Klassenfarben, Größe ∝ Q).
  4. Unterer T²-vs-Q-Plot: Punkte außerhalb der roten Limits sind Ausreißer. Mit Significance (alpha) die Grenzen justieren (Default 0.05).
  5. Remove outliers & refit: entfernt die Ausreißer und rechnet das Modell auf den verbliebenen Samples neu.

Ausgänge

  • Transformed Data — Scores der gewählten Komponenten (PCs), inkl. variance-Attribut je Spalte
  • Components (loadings) — Loadings als Tabelle (Zeilen = Komponenten)
  • Scores — Scores inkl. T2- und Q_residual-Meta-Spalten
  • Data — Originaldaten erweitert um T2- und Q_residual-Spalten
  • Outliers / Inliers — Daten unterteilt nach den aktiven Limits

🧪 Schnelltest (Entwickler)

python -c "
from Orange.data import Table
from orangepca import pca_analysis as pa
t = Table('iris')
r = pa.fit_pca(t.X, scale='auto', n_components='kaiser')
print('Kaiser-Komponenten:', r['n_components'])
print('erkl.Varianz:', [round(float(x),3) for x in r['explained_variance_ratio']])
o = pa.PCAOutliers(t.X, scale='auto', n_components=2)
print('T2-Limit:', round(o.T2_lim,3), ' Q-Limit:', round(o.Q_lim,3))
"

❓ Fehlerbehebung

  • Widget erscheint nicht → Oranges eigenes Python benutzt (nicht /usr/bin/python3); Orange vollständig neu starten.
  • Windows: Widget fehlt in der GUI → Paket landete evtl. in der User-Site (AppData\Roaming). Installer nutzt --no-user; als Administrator ausführen (siehe WellerLab-Haupt-README).

📄 Lizenz

MIT © Philipp Weller

Metadata

Release files for orangepca 0.1.2

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

Source distribution (sdist)

Source distribution for orangepca 0.1.2
File Size Uploaded Provenance Actions
orangepca-0.1.2.tar.gz 15.8 kB Without provenance Details for orangepca-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 30.3 kB

Release files / orangepca-0.1.2.tar.gz

Download URL orangepca-0.1.2.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
558df49185554cbacbfec788488bb84874eae151f982f03791f69cbc3a005aee
BLAKE2b-256 checksum
How to use checksums
da784a9e2c52f3e42305dc0515273449dd2b540d637fd631ae2c7ac7100f8c5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.8

Release files / orangepca-0.1.2-py3-none-any.whl

Download URL orangepca-0.1.2-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1afe00697ed0d0a0fce55dbaf53d2df629f4fbdc7298f439fa844a5800e7b5c8
BLAKE2b-256 checksum
How to use checksums
7e0714794d0948a3bbb7381a3f365ead029e71a714a8522bb64a2b769f09cdaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.8

Security for orangepca 0.1.2

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.2 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