Skip to content

ENH: Compile Factorizer class for all numeric dtypes #49624

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

Merged
merged 9 commits into from
Nov 16, 2022

Conversation

phofl
Copy link
Member

@phofl phofl commented Nov 10, 2022

The current implementation has a couple of ugly side effects in merge:

  • uint is cast to int, which causes overflow in some cases
  • float is cast to object

This does not enable the classes yet. Will do as a follow up.

@phofl phofl added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Enhancement labels Nov 10, 2022
@phofl
Copy link
Member Author

phofl commented Nov 15, 2022

cc @jbrockmendel would you mind having a look?

@phofl
Copy link
Member Author

phofl commented Nov 16, 2022

Adding factorize to the base class simplifies the follow up

@jbrockmendel
Copy link
Member

simplifies the follow up

i guess the follow-up will change how klass is found in merge.py?

@@ -101,6 +101,20 @@ from pandas._libs.khash cimport (
from pandas._libs.tslibs.util cimport get_c_string
from pandas._libs.missing cimport C_NA


cdef class Factorizer:
Copy link
Member

Choose a reason for hiding this comment

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

is there any particular reason for this to be in the pxi.in instead of the pyx?

Copy link
Member Author

Choose a reason for hiding this comment

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

Had some failures initially, but looks like this was caused by something else. Moved it back

@jbrockmendel
Copy link
Member

a few questions, generally looks good

@phofl
Copy link
Member Author

phofl commented Nov 16, 2022

simplifies the follow up

i guess the follow-up will change how klass is found in merge.py?

Yeah and also avoids having a million typing errors

@mroeschke mroeschke added this to the 2.0 milestone Nov 16, 2022
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

LGTM merge when ready @jbrockmendel

@jbrockmendel jbrockmendel merged commit f6d3cb2 into pandas-dev:main Nov 16, 2022
@jbrockmendel
Copy link
Member

thanks @phofl

@phofl phofl deleted the factorizer branch November 18, 2022 10:24
MarcoGorelli pushed a commit to MarcoGorelli/pandas that referenced this pull request Nov 18, 2022
* ENH: Compile Factorizer class for all numeric dtypes

* Fix test

* Fix test

* Add factorize to base class

* Remove ignores

* Move factorizer
mliu08 pushed a commit to mliu08/pandas that referenced this pull request Nov 27, 2022
* ENH: Compile Factorizer class for all numeric dtypes

* Fix test

* Fix test

* Add factorize to base class

* Remove ignores

* Move factorizer
@rhshadrach
Copy link
Member

This patch may have induced a potential regression. Please check the links below. If any ASVs are parameterized, the combinations of parameters that a regression has been detected appear as subbullets. This is a partially automated message.

@phofl
Copy link
Member Author

phofl commented Dec 24, 2022

I think this is a false positive, looks to me as this is impacted by the klib quadratic probing and seems to go back to normal when this pr was reverted

@phofl
Copy link
Member Author

phofl commented Dec 28, 2022

The links don't work. But this pr did not touch the code paths that the isin case takes

@rhshadrach
Copy link
Member

rhshadrach commented Jan 11, 2023

Reworked my scripts and updated the links, the subbullets now contain links to single parameterization of the benchmark where my code is identifying a regression. But certainly could be a false positive. For example, the first subbullet of algos.isin.IsInLongSeriesLookUpDominates.time_isin is an interesting case:

image

The first step up points to this PR whereas the second step up is the revert of quadratic programming. Both look like "regressions" but the revert of quadratic programming puts us back to where we started. I'm going to run asvs between certain commits; I'm just curious what's going on here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants