Skip to content

ModelReviewer/BayesianPPPCheck fails when using JAX backend - TypeError: einsum requires ndarray or scalar arguments, got xarray at position 0. #1589

@aswan89

Description

@aswan89

When executing meridian.analysis.review.reviewer.ModelReviewer(mmm).run() using the JAX backend end I receive the error ypeError: einsum requires ndarray or scalar arguments, got xarray at position 0.

Going through the code I believe the issue is here, line 181 of checks.py. model_context.input_data.revenue_per_kpi is a xarray object and multiplying kpi it coerces kpi to Xarray, but analyzer.filter_and_aggregate_geos_and_times is expecting backend.Tensor. I can't say for certain that the tensorflow backend can coerce xarray to something einsum can handle but it seems that JAX cannot.

For now I'm doing a workaround where I manually cast revenue_per_kpi via mmm.model_context.input_data.revenue_per_kpi = mmm.model_context.input_data.revenue_per_kpi.to_numpy()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions