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

Minor speedup using numba-stats #30

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jeethu
Copy link
Contributor

@jeethu jeethu commented May 23, 2024

Before:

$ DISABLE_NUMBA_STATS=1 python -m timeit -s "sz=5000;import numpy as np;import pandas as pd;from numerai_tools.scoring import numerai_corr;t = pd.Series(np.random.choice([0, 0.25, 0.5, 0.75, 1.0], size=sz), name='t');df = pd.DataFrame({'predictions': np.random.rand(sz)})" "numerai_corr(df, t)"

50 loops, best of 5: 3.9 msec per loop

After:

$ python -m timeit -s "sz=5000;import numpy as np;import pandas as pd;from numerai_tools.scoring import numerai_corr;t = pd.Series(np.random.choice([0, 0.25, 0.5, 0.75, 1.0], size=sz), name='t');df = pd.DataFrame({'predictions': np.random.rand(sz)})" "numerai_corr(df, t)"

100 loops, best of 5: 3.75 msec per loop

About 3.85% faster for computing numerai_corr(). I haven't benchmarked other functions.

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

Successfully merging this pull request may close these issues.

1 participant