Giter VIP home page Giter VIP logo

Comments (12)

yanhong-zhao-ef avatar yanhong-zhao-ef commented on May 16, 2024 1

Thank you for the swift response @pabloduque0! Look forward to the fixes

from lightweight_mmm.

pabloduque0 avatar pabloduque0 commented on May 16, 2024

@yanhong-zhao-ef Thanks for opening this one!

This is a known issue which we found recently and we will be sending out a fix in the upcoming days.

from lightweight_mmm.

pabloduque0 avatar pabloduque0 commented on May 16, 2024

Hello @yanhong-zhao-ef !

Should be fixed.

But let me know if you spot any inconsistencies.

from lightweight_mmm.

yanhong-zhao-ef avatar yanhong-zhao-ef commented on May 16, 2024

will test this out and report back thanks @pabloduque0

from lightweight_mmm.

yanhong-zhao-ef avatar yanhong-zhao-ef commented on May 16, 2024

Hey @pabloduque0 just tested the latest code and I seem to run into this issue when plotting the results:
loc("jit(_unstack)/jit(main)/squeeze[dimensions=(0,)]"("/Users/yanhongzhao/miniforge3/lib/python3.9/site-packages/matplotlib/cbook/__init__.py":1647:1)): error: 'mhlo.reshape' op requires the same element type for all operands and results loc("jit(_unstack)/jit(main)/squeeze[dimensions=(0,)]"("/Users/yanhongzhao/miniforge3/lib/python3.9/site-packages/matplotlib/cbook/__init__.py":1647:1)): error: 'mhlo.reshape' op requires the same element type for all operands and results

from lightweight_mmm.

pabloduque0 avatar pabloduque0 commented on May 16, 2024

Hello @yanhong-zhao-ef ,
What version of matplotlib are you using? Make sure is matplotlib==3.3.4.

If its not that I would need a reproducible code example (or colab).

But by the looks of it, it might be tied to some version missmatch as our test pass correctly and in the updated examples plot works fine.

from lightweight_mmm.

yanhong-zhao-ef avatar yanhong-zhao-ef commented on May 16, 2024

Hey @pabloduque0 I have updated the dependencies to be matplotlib==3.3.4 and the problem seems to be that the previous budget allocation and optimised budget are of different types of array for some reason:

So I did

    print(previous_budget_allocation)
    print(optimal_buget_allocation)
    print(jnp.shape(previous_budget_allocation))
    print(jnp.shape(optimal_buget_allocation))
    print(previous_budget_allocation.dtype)
    print(optimal_buget_allocation.dtype)
    print(type(previous_budget_allocation))
    print(type(optimal_buget_allocation))

Where previous budget allocation is from the starting values
and here is the output:

[1.74966221e+04 4.61873158e+03 3.51868975e+05 1.65627613e+05
 2.46767943e+03 2.50870759e+01 1.32379315e+03 3.06571498e+05]
[1.93767937e+05 8.06692206e+04 3.55350656e+05 1.67266469e+05
 2.81926225e+04 1.72227177e+02 2.14848183e+04 3.09604983e+03]
(8,)
(8,)
float64
float64
<class 'jaxlib.xla_extension.DeviceArray'>
<class 'numpy.ndarray'>

When I plot like this the whole thing works:

budget_allocation_plot = plot.plot_pre_post_budget_allocation_comparison(
        media_mix_model=mmm_model_obj,
        kpi_with_optim=solution["fun"],
        kpi_without_optim=kpi_without_optim,
        optimal_buget_allocation=optimal_buget_allocation,
        previous_budget_allocation=jnp.array(previous_budget_allocation),
        figure_size=(10, 10),
    )

from lightweight_mmm.

pabloduque0 avatar pabloduque0 commented on May 16, 2024

Yes, indeed they are different type. We updated a bit the naming and order of things in the notebook so it is more clear now, hopefully following that helps:

image

from lightweight_mmm.

yanhong-zhao-ef avatar yanhong-zhao-ef commented on May 16, 2024

All good thank you!

from lightweight_mmm.

pabloduque0 avatar pabloduque0 commented on May 16, 2024

@yanhong-zhao-ef thanks for reporting back!

from lightweight_mmm.

ibrahim-taher avatar ibrahim-taher commented on May 16, 2024

Hi when will this be included as a release on PyPi?

from lightweight_mmm.

pabloduque0 avatar pabloduque0 commented on May 16, 2024

@itaher-aclu v0.1.6 Is just live now! :)

from lightweight_mmm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.