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

Add blogpost on flox heuristics #695

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft

Add blogpost on flox heuristics #695

wants to merge 25 commits into from

Conversation

dcherian
Copy link
Contributor

@dcherian dcherian commented Jul 29, 2024

Copy link

vercel bot commented Jul 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
xarray-dev ✅ Ready (Inspect) Visit Preview 7 resolved Nov 12, 2024 9:42pm

@@ -0,0 +1,157 @@
---
title: 'flox: GroupBy, now with smarts!'
date: '2024-05-31'
Copy link
Contributor Author

@dcherian dcherian Jul 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
date: '2024-05-31'
date: '2024-08-05'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or whenever we decide to merge.


Unlike [Jaccard similarity](https://en.wikipedia.org/wiki/Jaccard_index), _containment_ [isn't skewed](http://ekzhu.com/datasketch/lshensemble.html) when one of the sets is much larger than the other.

The steps are as follows:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this bit clear and useful? Should I take it out? Or expand it?

Copy link
Member

@TomNicholas TomNicholas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Really incredible work you have done here @dcherian

I left a few comments: some nits, some minor suggestions on structure/content.

src/posts/flox-smart/index.md Outdated Show resolved Hide resolved
Comment on lines +27 to +29
Notice how much cleaner the graph is in this image:
![map-reduce](https://flox.readthedocs.io/en/latest/_images/new-map-reduce-reindex-True-annotated.svg)
See our [previous blog post](https://xarray.dev/blog/flox) or the [docs](https://flox.readthedocs.io/en/latest/implementation.html#method-map-reduce) for more.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little confusing that these two images are not for identical problems - the inputs are different.

src/posts/flox-smart/index.md Outdated Show resolved Hide resolved
src/posts/flox-smart/index.md Show resolved Hide resolved

_Note that the improvements here are strongly dependent on the details
of the grouping variable, the chunksize, and even dask's scheduler. In fact, writing this post
prompted the discovery of a bug in dask's scheduler that should substantially improve the "map-reduce"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link?!

src/posts/flox-smart/index.md Outdated Show resolved Hide resolved

Importantly this inference is fast — [~250ms for the US county](https://flox.readthedocs.io/en/latest/implementation.html#example-spatial-grouping) GroupBy problem in our [previous post](https://xarray.dev/blog/flox) where approximately 3000 groups are distributed over 2500 chunks; and ~1.25s for grouping by US watersheds ~87000 groups across 640 chunks.

## What's next?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your conclusion is a bit rambly, and I think some of the content (especially call-outs to any other groupby nerds who can help) could be in a footnote.

I think you should end with a succinct one-line conclusion that emphasises that most of this complexity can now be safely ignored by users.

Using the algorithm described below, flox will **automatically** set
`method="cohorts"` for this dataset unless specified, yielding a 5X decrease in
memory used and a 2X increase in runtime. Read on to figure out how!
Read on to figure out how!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A significant number of readers will think it's cool that this is now automatic, but not really care about the specifics of how you did it. That section below is also very dense. I think if there is any other information that you want readers to take away from this point onwards (e.g. that Groupers exist) you should telegraph it, and explicitly give them the option to skip forwards to a different subheading guilt-free.

@dcherian
Copy link
Contributor Author

dcherian commented Aug 6, 2024

Thanks for the review @TomNicholas . I'm waiting for some tests on the new dask release before revising: https://docs.dask.org/en/stable/changelog.html#improve-scheduling-efficiency-for-xarray-groupby-reduce-patterns

* main:
  Link to second cubed blog post (#702)
  Bump webpack from 5.92.1 to 5.93.0 (#700)
  Bump @fontsource-variable/inter from 5.0.18 to 5.0.20 (#698)
  Bump typescript from 5.5.3 to 5.5.4 (#699)
  Bump the dependencies group with 7 updates (#697)
@TomNicholas TomNicholas added the blog Blog post label Sep 13, 2024
* upstream/main:
  Fix hydration warning due to nested links (#725)
  Bump typescript from 5.6.2 to 5.6.3 (#724)
  [pre-commit.ci] pre-commit autoupdate (#720)
  Bump webpack from 5.95.0 to 5.96.1 (#723)
  Bump the dev-dependencies group across 1 directory with 4 updates (#719)
  Bump webpack from 5.94.0 to 5.95.0 (#718)
  Bump @fontsource-variable/inter from 5.0.20 to 5.1.0 (#717)
  Bump typescript from 5.5.4 to 5.6.2 (#716)
  Bump the dependencies group with 9 updates (#714)
  Bump next from 14.2.7 to 14.2.10 (#711)
  Turn off survey banner (#710)
  Update opengraph thumbnails (#709)
  GroupBy(multiple variables) (#703)
  Bump webpack from 5.93.0 to 5.94.0 (#704)
  Bump micromatch from 4.0.7 to 4.0.8 (#707)
  Bump the dependencies group with 7 updates (#705)
  Bump the dev-dependencies group with 4 updates (#706)

we run

```python
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: this doesn't reproduce any more, will need a different problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blog Blog post
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants