Skip to content

Wrong computation of scale in standardize_transform when using "zuko" backend #1091

Closed

Description

@fariedabuzaid

Describe the bug
Using the zuko backend when using standardize_transform gives a MonotonicAffineTransform. The scale is passed as $\frac{1}{\mathrm{std}(batch_x)}$. However, the MonotonicAffineTransform computes $\mathrm{exp(scale)} x + \mathrm{shift}$.

To Reproduce
Please add a minimal code example that reproduces the problem:

  1. Python 3.10, sbi 0.22
  2. Minimal code example:
from sbi.utils.sbiutils import standardizing_transform
import torch

x_batch = torch.randn(1000, 2) * 10 # std = 10
transform = standardizing_transform(x_batch, backend="zuko")

print(transform(x_batch).std(dim=0)) # std ~= 10

Expected behavior
The returned transform should standardize the data.

Activity

  1. added
    bug
    on Mar 22, 2024
  2. self-assigned this
    on Mar 24, 2024
  3. gmoss13 commented on Mar 24, 2024

    @gmoss13
    Contributor

    This bug is fixed in #1099 - note, however, that for Zuko, the correct syntax of the last line would be:
    print(transform()(x_batch).std(dim=0)). This now returns tensor([1., 1.]) for me after the latest push in #1099

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions