Skip to content

Commit 64b8044

Browse files
authored
[MAINT] Update Ctypes in line with scikit-learn: main (neurodata#141)
* Update submodule and c-types in tree/ --------- Signed-off-by: Adam Li <[email protected]>
1 parent eb946d4 commit 64b8044

31 files changed

+921
-927
lines changed

.github/workflows/build_wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# - [macos-12, macosx_*, arm64]
4545
- [windows-2019, win, AMD64]
4646

47-
python: [["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11.0-alpha - 3.11.0"]]
47+
python: [["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"]]
4848
# python[0] is used to specify the python versions made by cibuildwheel
4949

5050
env:

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
101101
- name: Setup build and install scikit-tree
102102
run: |
103-
./spin build -j 2 --forcesubmodule
103+
./spin build -j 2
104104
105105
- name: Ccache performance
106106
shell: bash -l {0}

.spin/cmds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def setup_submodule(forcesubmodule=False):
5454
This will update the submodule, which then must be commited so that
5555
git knows the submodule needs to be at a certain commit hash.
5656
"""
57-
commit_fpath = "./sktree/_lib/sklearn_fork/commit.txt"
57+
commit_fpath = "./sktree/_lib/commit.txt"
5858
submodule = "./sktree/_lib/sklearn_fork"
5959
commit = ""
6060
current_hash = ""

build_requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
meson
22
meson-python
3-
cython>=3.0
3+
cython==0.29.36
44
ninja
55
numpy
6-
scikit-learn>=1.3
6+
scikit-learn>=1.3.1
77
click
88
rich-click
99
doit

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ include = [
3838
dependencies = [
3939
'numpy',
4040
'scipy>=1.5.0',
41-
'scikit-learn>=1.3'
41+
'scikit-learn>=1.3.1'
4242
]
4343

4444

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
numpy>=1.25
22
scipy
3-
scikit-learn>=1.3
3+
scikit-learn>=1.3.1

sktree/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
)
6060
from .ensemble._honest_forest import HonestForestClassifier
6161
except ImportError as e:
62+
print(e.msg)
6263
msg = """Error importing scikit-tree: you cannot import scikit-tree while
6364
being in scikit-tree source directory; please exit the scikit-tree source
6465
tree first and relaunch your Python interpreter."""

sktree/_lib/meson.build

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,36 @@ foreach py_source: python_sources
4242
'./sklearn/ensemble/' + py_source,
4343
subdir: 'sktree/_lib/sklearn/ensemble'
4444
)
45-
endforeach
45+
endforeach
46+
47+
# TODO: Can remove if included in scikit-learn eventually
48+
# install tree/ submodule
49+
extensions = [
50+
'_quad_tree',
51+
]
52+
53+
foreach ext: extensions
54+
py3.extension_module(ext,
55+
cython_gen_cpp.process('./sklearn/neighbors/' + ext + '.pyx'),
56+
c_args: cython_c_args,
57+
include_directories: [incdir_numpy,],
58+
install: true,
59+
subdir: 'sktree/_lib/sklearn/neighbors/',
60+
)
61+
endforeach
62+
63+
# install tree/ submodule
64+
extensions = [
65+
'_typedefs',
66+
'_random',
67+
]
68+
69+
foreach ext: extensions
70+
py3.extension_module(ext,
71+
cython_gen_cpp.process('./sklearn/utils/' + ext + '.pyx'),
72+
c_args: cython_c_args,
73+
include_directories: [incdir_numpy,],
74+
install: true,
75+
subdir: 'sktree/_lib/sklearn/utils/',
76+
)
77+
endforeach

sktree/_lib/sklearn_fork

Submodule sklearn_fork updated 106 files

sktree/tree/_marginal.pxd

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@ import numpy as np
22

33
cimport numpy as cnp
44

5-
from .._lib.sklearn.tree._tree cimport DOUBLE_t # Type of y, sample_weight
6-
from .._lib.sklearn.tree._tree cimport DTYPE_t # Type of X
7-
from .._lib.sklearn.tree._tree cimport INT32_t # Signed 32 bit integer
8-
from .._lib.sklearn.tree._tree cimport SIZE_t # Type for indices and counters
9-
from .._lib.sklearn.tree._tree cimport UINT32_t # Unsigned 32 bit integer
105
from .._lib.sklearn.tree._tree cimport BaseTree, Node
6+
from .._lib.sklearn.tree._utils cimport UINT32_t
7+
from .._lib.sklearn.utils._typedefs cimport float32_t, float64_t, intp_t
118

129

1310
cpdef apply_marginal_tree(
1411
BaseTree tree,
1512
object X,
16-
const SIZE_t[:] marginal_indices,
17-
int traversal_method,
13+
const intp_t[:] marginal_indices,
14+
intp_t traversal_method,
1815
unsigned char use_sample_weight,
1916
object random_state
2017
)

0 commit comments

Comments
 (0)