Skip to content

Commit 54530c6

Browse files
cesar-perceivMainRo
authored andcommitted
Fixes np.NINF deprecation issue since numpy v2.0.0.
Signed-off-by: Cesar Laurent <[email protected]>
1 parent 1466437 commit 54530c6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ebm2onnx/convert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def to_onnx(model, dtype, name="ebm",
110110
feature_group=model.term_features_[feature_index]
111111

112112
if feature_type == 'continuous':
113-
bins = [np.NINF, np.NINF] + list(model.bins_[feature_group[0]][0])
113+
bins = [-np.inf, -np.inf] + list(model.bins_[feature_group[0]][0])
114114
additive_terms = model.term_scores_[feature_index]
115115

116116
feature_dtype = infer_features_dtype(dtype, feature_name)
@@ -157,7 +157,7 @@ def to_onnx(model, dtype, name="ebm",
157157
# the rule is to use bins_ index if there is one binning available for the way count.
158158
# otherwise, use the last binning for the feature
159159
bin_index = -1 if way_count > len(model.bins_[i_feature_index]) else way_count - 1
160-
bins = [np.NINF, np.NINF] + list(model.bins_[i_feature_index][bin_index])
160+
bins = [-np.inf, -np.inf] + list(model.bins_[i_feature_index][bin_index])
161161
input = graph.strip_to_transients(inputs[i_feature_index])
162162
i_parts.append(ebm.get_bin_index_on_continuous_value(bins)(input))
163163

tests/test_ebm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_get_bin_index_on_continuous_value():
1111
g = graph.create_graph()
1212
i = graph.create_input(g, "i", onnx.TensorProto.FLOAT, [None, 1])
1313

14-
g = ebm.get_bin_index_on_continuous_value([np.NINF, np.NINF, 0.2, 0.7, 1.2, 4.3])(i)
14+
g = ebm.get_bin_index_on_continuous_value([-np.inf, -np.inf, 0.2, 0.7, 1.2, 4.3])(i)
1515
g = graph.add_output(g, g.transients[0].name, onnx.TensorProto.INT64, [None, 1])
1616

1717
assert_model_result(g,

0 commit comments

Comments
 (0)