Source: scikit-learn
Version: 1.4.1.post1+dfsg-1
Severity: serious
User: debian...@lists.debian.org
Usertags: regression

Hi Maintainer

scikit-learn's autopkgtest regresses on i386 when tested with numpy
1.26 [1].  I've copied what I hope is the relevant part of the log
below.

Regards
Graham


[1] https://ci.debian.net/packages/s/scikit-learn/testing/i386/


1386s =================================== FAILURES
===================================
35104
1386s ______________________________ test_graphviz_toy
_______________________________
35105
1386s
35106
1386s def test_graphviz_toy():
35107
1386s # Check correctness of export_graphviz
35108
1386s clf = DecisionTreeClassifier(
35109
1386s max_depth=3, min_samples_split=2, criterion="gini", random_state=2
35110
1386s )
35111
1386s clf.fit(X, y)
35112
1386s
35113
1386s # Test export code
35114
1386s contents1 = export_graphviz(clf, out_file=None)
35115
1386s contents2 = (
35116
1386s "digraph Tree {\n"
35117
1386s 'node [shape=box, fontname="helvetica"] ;\n'
35118
1386s 'edge [fontname="helvetica"] ;\n'
35119
1386s '0 [label="x[0] <= 0.0\\ngini = 0.5\\nsamples = 6\\n'
35120
1386s 'value = [3, 3]"] ;\n'
35121
1386s '1 [label="gini = 0.0\\nsamples = 3\\nvalue = [3, 0]"] ;\n'
35122
1386s "0 -> 1 [labeldistance=2.5, labelangle=45, "
35123
1386s 'headlabel="True"] ;\n'
35124
1386s '2 [label="gini = 0.0\\nsamples = 3\\nvalue = [0, 3]"] ;\n'
35125
1386s "0 -> 2 [labeldistance=2.5, labelangle=-45, "
35126
1386s 'headlabel="False"] ;\n'
35127
1386s "}"
35128
1386s )
35129
1386s
35130
1386s assert contents1 == contents2
35131
1386s
35132
1386s # Test plot_options
35133
1386s contents1 = export_graphviz(
35134
1386s clf,
35135
1386s filled=True,
35136
1386s impurity=False,
35137
1386s proportion=True,
35138
1386s special_characters=True,
35139
1386s rounded=True,
35140
1386s out_file=None,
35141
1386s fontname="sans",
35142
1386s )
35143
1386s contents2 = (
35144
1386s "digraph Tree {\n"
35145
1386s 'node [shape=box, style="filled, rounded", color="black", '
35146
1386s 'fontname="sans"] ;\n'
35147
1386s 'edge [fontname="sans"] ;\n'
35148
1386s "0 [label=<x<SUB>0</SUB> &le; 0.0<br/>samples = 100.0%<br/>"
35149
1386s 'value = [0.5, 0.5]>, fillcolor="#ffffff"] ;\n'
35150
1386s "1 [label=<samples = 50.0%<br/>value = [1.0, 0.0]>, "
35151
1386s 'fillcolor="#e58139"] ;\n'
35152
1386s "0 -> 1 [labeldistance=2.5, labelangle=45, "
35153
1386s 'headlabel="True"] ;\n'
35154
1386s "2 [label=<samples = 50.0%<br/>value = [0.0, 1.0]>, "
35155
1386s 'fillcolor="#399de5"] ;\n'
35156
1386s "0 -> 2 [labeldistance=2.5, labelangle=-45, "
35157
1386s 'headlabel="False"] ;\n'
35158
1386s "}"
35159
1386s )
35160
1386s
35161
1386s assert contents1 == contents2
35162
1386s
35163
1386s # Test max_depth
35164
1386s contents1 = export_graphviz(clf, max_depth=0, class_names=True,
out_file=None)
35165
1386s contents2 = (
35166
1386s "digraph Tree {\n"
35167
1386s 'node [shape=box, fontname="helvetica"] ;\n'
35168
1386s 'edge [fontname="helvetica"] ;\n'
35169
1386s '0 [label="x[0] <= 0.0\\ngini = 0.5\\nsamples = 6\\n'
35170
1386s 'value = [3, 3]\\nclass = y[0]"] ;\n'
35171
1386s '1 [label="(...)"] ;\n'
35172
1386s "0 -> 1 ;\n"
35173
1386s '2 [label="(...)"] ;\n'
35174
1386s "0 -> 2 ;\n"
35175
1386s "}"
35176
1386s )
35177
1386s
35178
1386s assert contents1 == contents2
35179
1386s
35180
1386s # Test max_depth with plot_options
35181
1386s contents1 = export_graphviz(
35182
1386s clf, max_depth=0, filled=True, out_file=None, node_ids=True
35183
1386s )
35184
1386s contents2 = (
35185
1386s "digraph Tree {\n"
35186
1386s 'node [shape=box, style="filled", color="black", '
35187
1386s 'fontname="helvetica"] ;\n'
35188
1386s 'edge [fontname="helvetica"] ;\n'
35189
1386s '0 [label="node #0\\nx[0] <= 0.0\\ngini = 0.5\\n'
35190
1386s 'samples = 6\\nvalue = [3, 3]", fillcolor="#ffffff"] ;\n'
35191
1386s '1 [label="(...)", fillcolor="#C0C0C0"] ;\n'
35192
1386s "0 -> 1 ;\n"
35193
1386s '2 [label="(...)", fillcolor="#C0C0C0"] ;\n'
35194
1386s "0 -> 2 ;\n"
35195
1386s "}"
35196
1386s )
35197
1386s
35198
1386s assert contents1 == contents2
35199
1386s
35200
1386s # Test multi-output with weighted samples
35201
1386s clf = DecisionTreeClassifier(
35202
1386s max_depth=2, min_samples_split=2, criterion="gini", random_state=2
35203
1386s )
35204
1386s clf = clf.fit(X, y2, sample_weight=w)
35205
1386s
35206
1386s > contents1 = export_graphviz(clf, filled=True, impurity=False,
out_file=None)
35207
1386s
35208
1386s /usr/lib/python3/dist-packages/sklearn/tree/tests/test_export.py:131:
35209
1386s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
35210
1386s /usr/lib/python3/dist-packages/sklearn/utils/_param_validation.py:213:
in wrapper
35211
1386s return func(*args, **kwargs)
35212
1386s /usr/lib/python3/dist-packages/sklearn/tree/_export.py:906: in
export_graphviz
35213
1386s exporter.export(decision_tree)
35214
1386s /usr/lib/python3/dist-packages/sklearn/tree/_export.py:466: in export
35215
1386s self.recurse(decision_tree.tree_, 0, criterion=decision_tree.criterion)
35216
1386s /usr/lib/python3/dist-packages/sklearn/tree/_export.py:529: in recurse
35217
1386s ', fillcolor="%s"' % self.get_fill_color(tree, node_id)
35218
1386s /usr/lib/python3/dist-packages/sklearn/tree/_export.py:286: in
get_fill_color
35219
1386s return self.get_color(node_val)
35220
1386s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
35221
1386s
35222
1386s self = <sklearn.tree._export._DOTTreeExporter object at 0xe643bcf0>
35223
1386s value = -0.4691358024691358
35224
1386s
35225
1386s def get_color(self, value):
35226
1386s # Find the appropriate color & intensity for a node
35227
1386s if self.colors["bounds"] is None:
35228
1386s # Classification tree
35229
1386s color = list(self.colors["rgb"][np.argmax(value)])
35230
1386s sorted_values = sorted(value, reverse=True)
35231
1386s if len(sorted_values) == 1:
35232
1386s alpha = 0.0
35233
1386s else:
35234
1386s alpha = (sorted_values[0] - sorted_values[1]) / (1 - sorted_values[1])
35235
1386s else:
35236
1386s # Regression tree or multi-output
35237
1386s color = list(self.colors["rgb"][0])
35238
1386s alpha = (value - self.colors["bounds"][0]) / (
35239
1386s self.colors["bounds"][1] - self.colors["bounds"][0]
35240
1386s )
35241
1386s # compute the color as alpha against white
35242
1386s > color = [int(round(alpha * c + (1 - alpha) * 255, 0)) for c in color]
35243
1386s E ValueError: cannot convert float NaN to integer
35244
1386s
35245
1386s /usr/lib/python3/dist-packages/sklearn/tree/_export.py:258: ValueError

Reply via email to