Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix nightly 2.0 #720

Merged
merged 4 commits into from
Oct 31, 2023
Merged

Fix nightly 2.0 #720

merged 4 commits into from
Oct 31, 2023

Conversation

MarcAntoineSchmidtQC
Copy link
Member

Fixing glum to support numpy 2.0. Here is a summary of the changes:

  • directly support numpy 2.0: e.g. np.Inf -> np.inf
  • also use a nightly install of pyarrow (since the stable version doesn't support numpy 2.0)
  • some weird changes that should be monitored: statsmodels results are returned as a 2d array while we are using 1d array. The test used to work but now fails. Seems to now be okay with both numpy 2.0 and 1.26, so the likely culprit is probably that before numpy 2.0, [[a]] == [a].

Checklist

  • Added a CHANGELOG.rst entry

echo "Installing $pkg nightly"
micromamba remove -y --force $pkg
pip install --pre --no-deps --only-binary :all: --upgrade --timeout=60 -i $PRE_WHEELS $pkg
done
echo Install pyarrow nightly
micromamba remove -y --force pyarrow
pip install --extra-index-url https://pypi.fury.io/arrow-nightlies/ --prefer-binary --pre --no-deps pyarrow
Copy link
Member Author

Choose a reason for hiding this comment

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

np.log(min_alpha),
self.n_alphas,
base=np.e,
dtype=X.dtype,
Copy link
Member Author

Choose a reason for hiding this comment

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

Added the dtype here. It was causing issues with 32-bit runs because the alphas were set to be 64 bits, and this would upcast downstream variables when multiplying, causing typing issues with our C++ code.

@@ -1631,7 +1635,7 @@ def _wald_test_matrix(
# We want to calculate Rb_r^T (RVR)^{-1} Rb_r.
# We can do it in a more numerically stable way by using `scipy.linalg.solve`:
try:
test_stat = float(Rb_r.T @ linalg.solve(RVR, Rb_r))
Copy link
Member Author

Choose a reason for hiding this comment

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

not allowed anymore with numpy 2.0

@MarcAntoineSchmidtQC MarcAntoineSchmidtQC merged commit 5be4027 into fix-nightlies Oct 31, 2023
@MarcAntoineSchmidtQC MarcAntoineSchmidtQC deleted the fix-nightly-2.0 branch October 31, 2023 01:12
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants