Skip to content

dowhy.datasets.linear_dataset(treatment_is_binary=True) fails on NumPy 2.4.x #1388

@sueoglu

Description

@sueoglu

Describe the bug
Calling dowhy.datasets.linear_dataset with treatment_is_binary=True raises a ValueError on NumPy >= 2.4.0.

Steps to reproduce the behavior

import dowhy.datasets

data = dowhy.datasets.linear_dataset(
    beta=10,
    num_common_causes=5,
    num_instruments=2,
    num_samples=1000,
    treatment_is_binary=True,
)

Error
ValueError: setting an array element with a sequence.

Full traceback points to datasets.py:297:

t = np.vectorize(convert_to_binary)(t)
Image

Expected behavior

Dataset should be generated without error.

Version information:

  • DoWhy version 0.14
  • NumPy version 2.4.2
  • Python 3.12.3
  • OS Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions