Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark result of docs/scripts/readme_plot.py, native expression vs concise/simple API #22

Closed
rht opened this issue Jul 8, 2024 · 3 comments
Assignees
Labels
enhancement Improvements to existing features or performance.

Comments

@rht
Copy link
Contributor

rht commented Jul 8, 2024

For both pandas and Polars, there are at least 3 ways to do things for each steps. But they can be roughly split into 2: using native expression and using a simpler, more concise API. We should split further into 4 agents:

  1. MoneyAgentPolarsNative
  2. MoneyAgentPolarsConcise
  3. MoneyAgentPandasNative
  4. MoneyAgentPandasConcise

and benchmark them. Because:

  1. researchers who want to speed up their code further could see if the effort is worth it
  2. it could become a how-to guide on speeding up the code further via the native expression
@rht rht self-assigned this Jul 8, 2024
@rht
Copy link
Contributor Author

rht commented Jul 8, 2024

@adamamer20 https://github.com/adamamer20/mesa-frames/blob/bf1ccd9328f260a746c21a6bad7e15a7a6898dc3/docs/scripts/readme_plot.py#L132-L136 doesn't seem to work.
I got this error

  File "/github/projectmesa/mesa-frames/docs/scripts/readme_plot.py", line 163, in give_money
    .then(pl.col("wealth") + new_wealth["wealth"])
                             ~~~~~~~~~~^^^^^^^^^^
  File "/code/venv/lib/python3.11/site-packages/polars/dataframe/frame.py", line 1183, in __getitem__
    return get_df_item_by_key(self, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/venv/lib/python3.11/site-packages/polars/_utils/getitem.py", line 160, in get_df_item_by_key
    return df.get_column(key)
           ^^^^^^^^^^^^^^^^^^
  File "/code/venv/lib/python3.11/site-packages/polars/dataframe/frame.py", line 7557, in get_column
    return wrap_s(self._df.get_column(name))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
polars.exceptions.ColumnNotFoundError: wealth

@adamamer20
Copy link
Collaborator

adamamer20 commented Jul 9, 2024

This is a good idea, we can also check the performance overhead of mesa-frames.
I corrected the bug in main, i will make the necessary changes in #23.

@adamamer20 adamamer20 added the enhancement Improvements to existing features or performance. label Jul 9, 2024
@adamamer20 adamamer20 added this to the 1.0.0 Alpha Release milestone Jul 9, 2024
@rht
Copy link
Contributor Author

rht commented Jul 12, 2024

Closed via #23 and #24.

@rht rht closed this as completed Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing features or performance.
Projects
None yet
Development

No branches or pull requests

2 participants