Skip to content

Updates tree decision criterion for scikit-learn 1.2 #115

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

Merged
merged 19 commits into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix issue
  • Loading branch information
xadupre committed Jul 2, 2023
commit d553c724c43cf3fb9672aaa561d211b7b7fe21d8
2 changes: 0 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ jobs:
architecture: 'x64'
- script: gcc --version
displayName: 'gcc version'
- script: brew update
displayName: 'brew update'
- script: export
displayName: 'export'
- script: gcc --version
Expand Down
2 changes: 1 addition & 1 deletion mlinsights/mlmodel/sklearn_transform_inv_fct.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def transform(self, X, y):
if y is None:
return X, None
self._check_is_fitted()
if len(y.shape) == 1 or y.dtype in (numpy.str, numpy.int32, numpy.int64):
if len(y.shape) == 1 or y.dtype in (numpy.str_, numpy.int32, numpy.int64):
# permutes classes
yp = y.copy().ravel()
num = numpy.issubdtype(y.dtype, numpy.floating)
Expand Down
16 changes: 6 additions & 10 deletions mlinsights/mltree/tree_digitize.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def add_root(index):
is_left = False
is_leaf = False
threshold = bins[index]
n = tree_add_node(
tree, parent, is_left, is_leaf, 0, threshold, 0, 1, 1.)
n = tree_add_node(tree, parent, is_left, is_leaf, 0, threshold, 0, 1, 1., 0)
values.append(UNUSED)
n_nodes.append(n)
return n
Expand All @@ -96,16 +95,15 @@ def add_nodes(parent, i, j, is_left):
# it means j is the parent split
if i == j:
# leaf
n = tree_add_node(tree, parent, is_left, True, 0, 0, 0, 1, 1.)
n = tree_add_node(tree, parent, is_left, True, 0, 0, 0, 1, 1., 0)
n_nodes.append(n)
values.append(i)
return n
if i + 1 == j:
# split
values.append(UNUSED)
th = bins[i]
n = tree_add_node(tree, parent, is_left,
False, 0, th, 0, 1, 1.)
n = tree_add_node(tree, parent, is_left, False, 0, th, 0, 1, 1., 0)
n_nodes.append(n)
add_nodes(n, i, i, True)
add_nodes(n, i, j, False)
Expand All @@ -115,8 +113,7 @@ def add_nodes(parent, i, j, is_left):
values.append(UNUSED)
index = (i + j) // 2
th = bins[index]
n = tree_add_node(tree, parent, is_left,
False, 0, th, 0, 1, 1.)
n = tree_add_node(tree, parent, is_left, False, 0, th, 0, 1, 1., 0)
n_nodes.append(n)
add_nodes(n, i, index, True)
add_nodes(n, index, j, False)
Expand All @@ -126,16 +123,15 @@ def add_nodes(parent, i, j, is_left):
if i + 1 == j:
# leaf
values.append(j)
n = tree_add_node(tree, parent, is_left, True, 0, 0, 0, 1, 1.)
n = tree_add_node(tree, parent, is_left, True, 0, 0, 0, 1, 1., 0)
n_nodes.append(n)
return n
if i + 1 < j:
# split
values.append(UNUSED)
index = (i + j) // 2
th = bins[index]
n = tree_add_node(tree, parent, is_left,
False, 0, th, 0, 1, 1.)
n = tree_add_node(tree, parent, is_left, False, 0, th, 0, 1, 1., 0)
n_nodes.append(n)
add_nodes(n, i, index, True)
add_nodes(n, index, j, False)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy