Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 10 additions & 2 deletions _cmake/constants.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,19 @@ configure_file(
#

# AVX instructions
# Check with bash _cmake/intrin.sh <avx function name>
if(MSVC)
# disable warning for #pragma unroll
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
add_compile_options(/wd4068)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
# Other possible flags
# "-mavx512f", "-mavx512bw", "-mavx512dq", "-mavx512vl", "-mlzcnt"
# See https://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
# -march=native selects the best option for AVX instructions
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native -mf16c")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()

Expand All @@ -176,6 +183,7 @@ message(STATUS "CMAKE_C_FLAGS_INIT=${CMAKE_C_FLAGS_INIT}")
message(STATUS "CMAKE_C_FLAGS=${CMAKE_C_FLAGS}")
message(STATUS "CMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}")
message(STATUS "CMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}")
message(STATUS "CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
message(STATUS "CMAKE_CXX_FLAGS_INIT=${CMAKE_CXX_FLAGS_INIT}")
message(STATUS "CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")
Expand Down
2 changes: 1 addition & 1 deletion _doc/examples/plot_decision_tree_logreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def draw_border(
cmap = plt.cm.tab20
Z = Z.reshape(xx.shape)
if ax is None:
fig, ax = plt.subplots(1, 1, figsize=figsize or (4, 3))
_fig, ax = plt.subplots(1, 1, figsize=figsize or (4, 3))
ax.pcolormesh(xx, yy, Z, cmap=cmap)

# Plot also the training points
Expand Down
2 changes: 1 addition & 1 deletion _doc/examples/plot_leave_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def draw_border(
cmap = plt.cm.tab20
Z = Z.reshape(xx.shape)
if ax is None:
fig, ax = plt.subplots(1, 1, figsize=figsize or (4, 3))
_fig, ax = plt.subplots(1, 1, figsize=figsize or (4, 3))
ax.pcolormesh(xx, yy, Z, cmap=cmap)

# Plot also the training points
Expand Down
2 changes: 1 addition & 1 deletion _doc/examples/plot_logistic_regression_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def draw_border(
cmap = plt.cm.tab20
Z = Z.reshape(xx.shape)
if ax is None:
fig, ax = plt.subplots(1, 1, figsize=figsize or (4, 3))
_fig, ax = plt.subplots(1, 1, figsize=figsize or (4, 3))
ax.pcolormesh(xx, yy, Z, cmap=cmap)

# Plot also the training points
Expand Down
2 changes: 1 addition & 1 deletion _doc/examples/plot_piecewise_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def graph(X, Y, model):
Z = Z.reshape(xx.shape)

# Put the result into a color plot
fig, ax = plt.subplots(1, 1, figsize=(4, 3))
_fig, ax = plt.subplots(1, 1, figsize=(4, 3))
ax.pcolormesh(xx, yy, Z, cmap=plt.cm.Paired)

# Plot also the training points
Expand Down
2 changes: 1 addition & 1 deletion _doc/examples/plot_predictable_tsne.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def plot_embedding(Xp, y, imgs, title=None, figsize=(12, 4)):
x_min, x_max = numpy.min(Xp, 0), numpy.max(Xp, 0)
X = (Xp - x_min) / (x_max - x_min)

fig, ax = plt.subplots(1, 2, figsize=figsize)
_fig, ax = plt.subplots(1, 2, figsize=figsize)
for i in range(X.shape[0]):
ax[0].text(
X[i, 0],
Expand Down
4 changes: 2 additions & 2 deletions _doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ Source are available at `sdpython/mlinsights <https://github.com/sdpython/mlinsi
Older versions
++++++++++++++

* `0.5.2 <../v0.5.1/index.html>`_
* `0.5.1 <../v0.5.1/index.html>`_
* `0.5.3 <../v0.5.3/index.html>`_
* `0.5.2 <../v0.5.2/index.html>`_
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ def test_criterions(self):
assert_criterion_equal(c1, c2)
left1, right1 = _test_criterion_node_impurity_children(c1)
left2, right2 = _test_criterion_node_impurity_children(c2)
self.assertAlmostEqual(left1, left2)
self.assertAlmostEqual(right1, right2)
self.assertAlmostEqual(left1, left2, atol=1e-8)
self.assertAlmostEqual(right1, right2, atol=1e-8)
v1 = _test_criterion_node_value(c1)
v2 = _test_criterion_node_value(c2)
self.assertEqual(v1, v2)
assert_criterion_equal(c1, c2)
p1 = _test_criterion_impurity_improvement(c1, 0.0, left1, right1)
p2 = _test_criterion_impurity_improvement(c2, 0.0, left2, right2)
self.assertAlmostEqual(p1, p2)
self.assertAlmostEqual(p1, p2, atol=1e-8)

X = numpy.array([[1.0, 2.0, 10.0, 11.0]]).T
y = numpy.array([0.9, 1.1, 1.9, 2.1])
Expand All @@ -123,7 +123,7 @@ def test_criterions(self):
_test_criterion_init(c2, ys, w, 1.0, ind, 1, y.shape[0])
i1 = _test_criterion_node_impurity(c1)
i2 = _test_criterion_node_impurity(c2)
self.assertAlmostEqual(i1, i2)
self.assertAlmostEqual(i1, i2, atol=1e-8)
v1 = _test_criterion_node_value(c1)
v2 = _test_criterion_node_value(c2)
self.assertEqual(v1, v2)
Expand All @@ -136,14 +136,14 @@ def test_criterions(self):
_test_criterion_update(c2, i)
left1, right1 = _test_criterion_node_impurity_children(c1)
left2, right2 = _test_criterion_node_impurity_children(c2)
self.assertAlmostEqual(left1, left2)
self.assertAlmostEqual(right1, right2)
self.assertAlmostEqual(left1, left2, atol=1e-8)
self.assertAlmostEqual(right1, right2, atol=1e-8)
v1 = _test_criterion_node_value(c1)
v2 = _test_criterion_node_value(c2)
self.assertEqual(v1, v2)
p1 = _test_criterion_impurity_improvement(c1, 0.0, left1, right1)
p2 = _test_criterion_impurity_improvement(c2, 0.0, left2, right2)
self.assertAlmostEqual(p1, p2)
self.assertAlmostEqual(p1, p2, atol=1e-8)

@unittest.skipIf(
pv.Version(skl_ver) < pv.Version("1.3.3"),
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_xrun_doc/test_documentation_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def run_test(self, fold: str, name: str, verbose=0) -> int:
cmds = [sys.executable, "-u", os.path.join(fold, name)]
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
res = p.communicate()
out, err = res
_out, err = res
st = err.decode("ascii", errors="ignore")
if st and "Traceback" in st:
if "No module named 'onnxruntime'" in st:
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
strategy:
matrix:
Python311-Linux:
python.version: '3.11'
python.version: '3.12'
maxParallel: 3

steps:
Expand Down
2 changes: 1 addition & 1 deletion mlinsights/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.5.2"
__version__ = "0.5.3"
__author__ = "Xavier Dupré"
__github__ = "https://github.com/sdpython/mlinsights"
__url__ = "https://sdpython.github.io/doc/dev/mlinsights/"
Expand Down
21 changes: 10 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ license = {file = "LICENSE.txt"}
name = "mlinsights"
readme = "README.rst"
requires-python = ">=3.10"
version = "0.5.2"
version = "0.5.3"

[project.urls]
homepage = "https://sdpython.github.io/doc/mlinsights/dev/"
Expand All @@ -52,7 +52,7 @@ dev = [
"onnxruntime",
"pandas",
"psutil",
"pybind11>=2.12.0",
"pybind11>=3",
"pytest",
"pytest-cov",
"ruff",
Expand All @@ -73,7 +73,7 @@ requires = [
"Cython>=3.0.10",
"cmake",
"numpy>=2.0",
"pybind11>=2.12.0",
"pybind11>=3",
"scikit-learn>=1.3.0",
"scipy",
"setuptools",
Expand Down Expand Up @@ -104,36 +104,35 @@ namespaces = false

[tool.cibuildwheel]
build = "*"
manylinux-x86_64-image = "manylinux2014"
manylinux-x86_64-image = "manylinux_2_28" # "manylinux2014"

[tool.cibuildwheel.linux]
archs = ["x86_64"]
build = "cp*"
skip = "cp36-* cp37-* cp38-* cp39-* cp310-* cp314-* cp315-* pypy* *musllinux*"
manylinux-x86_64-image = "manylinux2014"
skip = "cp36-* cp37-* cp38-* cp39-* cp314-* cp314t-* cp315-* pypy* *musllinux*"
manylinux-x86_64-image = "manylinux_2_28" # "manylinux2014"
before-build = "pip install auditwheel-symbols abi3audit"
build-verbosity = 1
repair-wheel-command = "auditwheel-symbols --manylinux 2014 {wheel} ; abi3audit {wheel} ; auditwheel repair -w {dest_dir} {wheel} || exit 0"
# repair-wheel-command = "auditwheel-symbols --manylinux 2014 {wheel} || exit 0"
repair-wheel-command = "auditwheel-symbols --manylinux 2_28 {wheel} ; abi3audit {wheel} ; auditwheel repair -w {dest_dir} {wheel} || exit 0"

[tool.cibuildwheel.macos]
archs = "arm64" # or "universal2" for a single universal wheel
environment = """
MACOSX_DEPLOYMENT_TARGET=14.0
MACOSX_DEPLOYMENT_TARGET=15.0
LDFLAGS='-L$(brew --prefix libomp)/lib'
CPPFLAGS='-I$(brew --prefix libomp)/include'
CFLAGS='-I$(brew --prefix libomp)/include -arch x86_64 -arch arm64'
CXXFLAGS='-I$(brew --prefix libomp)/include -arch x86_64 -arch arm64'
DYLD_LIBRARY_PATH='$(brew --prefix libomp)/lib:$DYLD_LIBRARY_PATH'
"""
build = "cp*"
skip = "cp36-* cp37-* cp38-* cp39-* cp310-* cp314-* cp315-* pypy* pp*"
skip = "cp36-* cp37-* cp38-* cp39-* cp314-* cp314t-* cp315-* pypy* pp*"
before-build = "brew install libomp llvm&&echo 'export PATH=\"/opt/homebrew/opt/llvm/bin:$PATH\"' >> /Users/runner/.bash_profile"

[tool.cibuildwheel.windows]
archs = ["AMD64"]
build = "cp*"
skip = "cp36-* cp37-* cp38-* cp39-* cp310-* cp314-* cp315-* pypy*"
skip = "cp36-* cp37-* cp38-* cp39-* cp314-* cp314t-* cp315-* pypy*"

[tool.cython-lint]
max-line-length = 88
Expand Down
9 changes: 4 additions & 5 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
--extra-index-url https://download.pytorch.org/whl/cpu
black
category_encoders
chardet
clang-format
cmakelang
coverage
cython>=3.0.10
cython-lint
furo; sys_platform == 'linux'
ijson
Expand All @@ -17,7 +17,6 @@ numba
numpy>=2.0
onnxruntime
pandas_streaming
pybind11>=2.12.0
pytest
pytest-cov
pytest-subtests
Expand All @@ -26,13 +25,13 @@ ruff
scikit-learn>=1.5.0
seaborn
skl2onnx>=1.14.1
sphinx<7.2; sys_platform == 'linux' # furo still fails with sphinx==7.2.0 (issue unused furo.css)
sphinx>=8; sys_platform == 'linux' # furo still fails with sphinx==7.2.0 (issue unused furo.css)
sphinx-gallery; sys_platform == 'linux'
sphinx-issues; sys_platform == 'linux'
git+https://github.com/sdpython/sphinx-runpython.git
sphinx-runpython
toml; python_version < '3.11'
tomli
torch
torch>=2.9.0; sys_platform != 'darwin'
torchvision
torchaudio
tqdm
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cython>=3.0.10
numpy
pybind11>=2.12.0
pybind11>=3
scikit-learn>=1.3.0
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ def get_package_data():

setup(
name="mlinsights",
version=get_version_str(here, "0.5.2"),
version=get_version_str(here, "0.5.3"),
description=get_description(),
long_description=get_long_description(here),
author="Xavier Dupré",
Expand All @@ -693,9 +693,10 @@ def get_package_data():
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
cmdclass={
"build_ext": cmake_build_ext,
Expand Down
Loading