Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
Signed-off-by: xadupre <[email protected]>
  • Loading branch information
xadupre committed Dec 19, 2024
1 parent f41ffd8 commit 99ba2e4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# -- Project information -----------------------------------------------------

project = "sklearn-onnx"
copyright = "2018-2023, Microsoft"
copyright = "2018-2025, Microsoft"
author = "Microsoft"
version = skl2onnx.__version__
release = version
Expand Down Expand Up @@ -82,8 +82,6 @@
"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
"seaborn": ("https://seaborn.pydata.org/", None),
"scikit-learn": ("https://scikit-learn.org/stable/", None),
"sklearn": ("https://scikit-learn.org/stable/", None),
"skl2onnx": ("https://onnx.ai/sklearn-onnx/", None),
"sklearn-onnx": ("https://onnx.ai/sklearn-onnx/", None),
}

Expand All @@ -105,6 +103,7 @@
epkg_dictionary = {
"C": "https://en.wikipedia.org/wiki/C_(programming_language)",
"C++": "https://en.wikipedia.org/wiki/C%2B%2B",
"CatBoost": "https://catboost.ai/",
"cython": "https://cython.org/",
"DOT": "https://www.graphviz.org/doc/info/lang.html",
"ImageNet": "http://www.image-net.org/",
Expand All @@ -118,6 +117,7 @@
"ONNX operators": "https://onnx.ai/onnx/operators/",
"ONNX ML operators": "https://onnx.ai/onnx/operators/",
"ONNX ML Operators": "https://onnx.ai/onnx/operators/",
"ONNX Zoo": "https://github.com/onnx/models/",
"onnxmltools": "https://github.com/onnx/onnxmltools",
"onnxruntime": "https://microsoft.github.io/onnxruntime/",
"openmp": "https://en.wikipedia.org/wiki/OpenMP",
Expand Down
8 changes: 6 additions & 2 deletions docs/index_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ The tutorial was tested with following version:
.. runpython::
:showcode:

import catboost
try:
import catboost
except Exception as e:
print("Unable to import catboost due to", e)
catboost = None
import numpy
import scipy
import sklearn
Expand All @@ -39,7 +43,7 @@ The tutorial was tested with following version:
mods = [numpy, scipy, sklearn, lightgbm, xgboost, catboost,
onnx, onnxmltools, onnxruntime,
skl2onnx]
mods = [(m.__name__, m.__version__) for m in mods]
mods = [(m.__name__, m.__version__) for m in mods if m is not None]
mx = max(len(_[0]) for _ in mods) + 1
for name, vers in sorted(mods):
print("%s%s%s" % (name, " " * (mx - len(name)), vers))
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ select = [
]

[tool.ruff.lint.per-file-ignores]
"**" = ["C413", "C408", "C417", "E731", "PIE808", "RUF012", "RUF015", "SIM103", "SIM108", "SIM114", "SIM910", "UP008", "UP015", "UP028", "UP030", "UP031", "UP032"]
"**" = [
"C413", "C408", "C417",
"E731",
"PIE808",
"RUF012", "RUF015",
"SIM103", "SIM108", "SIM114", "SIM910",
"UP006", "UP008", "UP015", "UP028", "UP030", "UP031", "UP035", "UP032"
]
"**/__init__.py" = ["F401"]
"docs/**" = ["B018", "E402"]
"skl2onnx/algebra/onnx_ops.py" = ["F821"]
Expand Down
3 changes: 1 addition & 2 deletions skl2onnx/operator_converters/nearest_neighbours.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ def _convert_nearest_neighbors(operator, container, k=None, radius=None):
single_reg = (
not hasattr(op, "_y")
or len(op._y.shape) == 1
or len(op._y.shape) == 2
and op._y.shape[1] == 1
or (len(op._y.shape) == 2 and op._y.shape[1] == 1)
)
ndim = 1 if single_reg else op._y.shape[1]

Expand Down
13 changes: 5 additions & 8 deletions tests/test_utils/reference_implementation_zipmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ class ZipMapDictionary(dict):
"""
Custom dictionary class much faster for this runtime,
it implements a subset of the same methods.
:param rev_keys: returns by ``build_rev_keys``, *{keys: column index}*
:param values: values
:param mat: matrix if values is a row index, one or two dimensions
"""

__slots__ = ["_rev_keys", "_values", "_mat"]
__slots__ = ["_mat", "_rev_keys", "_values", ]

@staticmethod
def build_rev_keys(keys):
Expand All @@ -26,13 +30,6 @@ def build_rev_keys(keys):
return res

def __init__(self, rev_keys, values, mat=None):
"""
@param rev_keys returns by @see me build_rev_keys,
*{keys: column index}*
@param values values
@param mat matrix if values is a row index,
one or two dimensions
"""
if mat is not None:
if not isinstance(mat, numpy.ndarray):
raise TypeError(f"matrix is expected, got {type(mat)}.")
Expand Down

0 comments on commit 99ba2e4

Please sign in to comment.