Skip to main content

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-pytorch provides metric processors only — no CLI or job orchestration. Use directly via Python or with dqm-ml-job for 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_fid
  • domain_gap_mmd_linear
  • domain_gap_wasserstein_1d
  • domain_gap_klmvn_diag

Requirements

  • torch
  • torchvision
  • scipy

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dqm_ml_pytorch-2.0.0rc0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dqm_ml_pytorch-2.0.0rc0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file dqm_ml_pytorch-2.0.0rc0.tar.gz.

File metadata

  • Download URL: dqm_ml_pytorch-2.0.0rc0.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

Hashes for dqm_ml_pytorch-2.0.0rc0.tar.gz
Algorithm Hash digest
SHA256 e8e2a3d254ccb6f30201350d151a5ae489e558143e531f9eef8b8996a58bdb01
MD5 dd4f7411787da2e57a93b61b33fe78ac
BLAKE2b-256 3479ac248c89b4f6a48ca94f0e8456db2be3dc46c2c934a0a83bd2fd55e85d3f

See more details on using hashes here.

File details

Details for the file dqm_ml_pytorch-2.0.0rc0-py3-none-any.whl.

File metadata

  • Download URL: dqm_ml_pytorch-2.0.0rc0-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

Hashes for dqm_ml_pytorch-2.0.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1052ee484c416a27411ce5875a56b664a602b51bb0c02ebd30d12730510fa4e
MD5 c68d7e237045c9029805153a6e433c35
BLAKE2b-256 7977a962d0749e52882f2cad4639a7284c5ebd16bbcb2844d1209136731e4c74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page