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

Numpy v2.0.0 has deprecated np.NINF #17

Closed
cesar-perceiv opened this issue Jun 27, 2024 · 1 comment · Fixed by #18
Closed

Numpy v2.0.0 has deprecated np.NINF #17

cesar-perceiv opened this issue Jun 27, 2024 · 1 comment · Fixed by #18

Comments

@cesar-perceiv
Copy link
Contributor

  • ebm2onnx version: 3.1.3
  • Python version: 3.12
  • Operating System: Debian 12 (bookworm)

Description

Serialization of an EBM model fails with numpy==v2.0.0 due to np.NINF being deprecated.

What I Did

onnx_model = ebm2onnx.to_onnx(model=model, dtype=ebm2onnx.get_dtype_from_pandas(features))

File [/usr/local/lib/python3.12/site-packages/ebm2onnx/convert.py:113](http://localhost:8888/usr/local/lib/python3.12/site-packages/ebm2onnx/convert.py#line=112), in to_onnx(model, dtype, name, predict_proba, explain, target_opset, prediction_name, probabilities_name, explain_name)
    110 feature_group=model.term_features_[feature_index]
    112 if feature_type == 'continuous':
--> 113     bins = [np.NINF, np.NINF] + list(model.bins_[feature_group[0]][0])
    114     additive_terms = model.term_scores_[feature_index]
    116     feature_dtype = infer_features_dtype(dtype, feature_name)

File [/usr/local/lib/python3.12/site-packages/numpy/__init__.py:397](http://localhost:8888/usr/local/lib/python3.12/site-packages/numpy/__init__.py#line=396), in __getattr__(attr)
    394     raise AttributeError(__former_attrs__[attr])
    396 if attr in __expired_attributes__:
--> 397     raise AttributeError(
    398         f"`np.{attr}` was removed in the NumPy 2.0 release. "
    399         f"{__expired_attributes__[attr]}"
    400     )
    402 if attr == "chararray":
    403     warnings.warn(
    404         "`np.chararray` is deprecated and will be removed from "
    405         "the main namespace in the future. Use an array with a string "
    406         "or bytes dtype instead.", DeprecationWarning, stacklevel=2)

AttributeError: `np.NINF` was removed in the NumPy 2.0 release. Use `-np.inf` instead.

I will make a PR for this easy fix.

@MainRo
Copy link
Collaborator

MainRo commented Jul 25, 2024

Thanks!

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

Successfully merging a pull request may close this issue.

2 participants