Python library designed to provide core dqml domain gap metrics, as well as common API shared by metrics
Project description
DQM-ML PyTorch
PyTorch-based metrics for DQM-ML V2. Provides advanced domain gap analysis for comparing dataset distributions.
Installation
pip install dqm-ml-pytorch
Note:
dqm-ml-pytorchprovides metric processors only — no CLI or job orchestration. Use directly via Python or withdqm-ml-jobfor YAML config execution.
Usage
Using Python Directly
import numpy as np
from dqm_ml_pytorch import DomainGapProcessor
# Create source and target embeddings (example data)
source_embeddings = np.random.randn(100, 2048).astype(np.float32)
target_embeddings = np.random.randn(100, 2048).astype(np.float32)
# Create and configure the processor
processor = DomainGapProcessor(
name="domain_drift",
config={
"INPUT": {"embedding_col": "embedding"},
"DELTA": {"metric": "mmd_linear"}
}
)
# Compute statistics for both datasets
source_stats = processor.compute_batch_metric({"embedding": source_embeddings})
target_stats = processor.compute_batch_metric({"embedding": target_embeddings})
# Compute the domain gap delta
result = processor.compute_delta(source_stats, target_stats)
print(f"Domain Gap (MMD): {result['domain_gap_mmd_linear']}")
With dqm-ml-job
For running from a YAML config, install together with dqm-ml-job:
pip install dqm-ml-job dqm-ml-pytorch
Then use this config:
metrics_processor:
domain_drift:
type: domain_gap
INPUT:
embedding_col: "features"
DELTA:
metric: "mmd_linear"
Features
| Metric | Full Name | Best For |
|---|---|---|
| FID | Fréchet Inception Distance | Image embeddings |
| MMD | Maximum Mean Discrepancy | General kernel-based comparison |
| Wasserstein | 1D Earth Mover's Distance | 1D distributions |
| KLMVN | KL-Divergence (Multivariate Normal) | Gaussian distributions |
Output
Returns statistical distance values:
domain_gap_fiddomain_gap_mmd_lineardomain_gap_wasserstein_1ddomain_gap_klmvn_diag
Requirements
torchtorchvisionscipy
Dependencies
DQM-ML is modular. For domain gap metrics:
# Minimal: use as library only
pip install dqm-ml-pytorch
# For YAML config execution
pip install dqm-ml-job dqm-ml-pytorch
# Full stack with all metrics
pip install dqm-ml-job dqm-ml-core dqm-ml-pytorch
See Also
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dqm_ml_pytorch-2.0.0rc1.tar.gz.
File metadata
- Download URL: dqm_ml_pytorch-2.0.0rc1.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
879b339c995027161c4514ce6f01d192ee37136244cf847428ec58de937257a8
|
|
| MD5 |
25167e96537744f389aa064abd09d048
|
|
| BLAKE2b-256 |
e9326f8688d70cbad5f7f8d5f4397c522f7c9882327168340ce706c0c949bcb3
|
File details
Details for the file dqm_ml_pytorch-2.0.0rc1-py3-none-any.whl.
File metadata
- Download URL: dqm_ml_pytorch-2.0.0rc1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
302904ad0bd890d870ccaab894af5ad78453590c789a8791f21f1c6d002a84a7
|
|
| MD5 |
c27ccafccb6ee89a2e3ea24bdc991af6
|
|
| BLAKE2b-256 |
7dda1b07c2f5af2a7e6e788d5382f563001bea702bcd5b9c6f8530b506412d81
|