diff --git a/yggdrasil_decision_forests/port/python/CHANGELOG.md b/yggdrasil_decision_forests/port/python/CHANGELOG.md index 77889aeb..195f4008 100644 --- a/yggdrasil_decision_forests/port/python/CHANGELOG.md +++ b/yggdrasil_decision_forests/port/python/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## HEAD +## 0.5.0 - 2024-06-17 ### Feature @@ -10,6 +10,12 @@ more convenient than`ydf.verbose`. - Add SKLearn to YDF model converter: `ydf.from_sklearn`. - Improve error messages when calling the model with non supported data. +- Add support for numpy 2.0. + +### Tutorials + +- Add anomaly detection tutorial. +- Add YDF and JAX model composition tutorial. ### Fix diff --git a/yggdrasil_decision_forests/port/python/config/setup.py b/yggdrasil_decision_forests/port/python/config/setup.py index 8727d908..3a78340f 100644 --- a/yggdrasil_decision_forests/port/python/config/setup.py +++ b/yggdrasil_decision_forests/port/python/config/setup.py @@ -21,7 +21,7 @@ from setuptools.command.install import install from setuptools.dist import Distribution -_VERSION = "0.4.3" +_VERSION = "0.5.0" with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() diff --git a/yggdrasil_decision_forests/port/python/tools/build_windows_release.bat b/yggdrasil_decision_forests/port/python/tools/build_windows_release.bat index 816f382c..6256c9bb 100644 --- a/yggdrasil_decision_forests/port/python/tools/build_windows_release.bat +++ b/yggdrasil_decision_forests/port/python/tools/build_windows_release.bat @@ -34,7 +34,7 @@ cls setlocal -set YDF_VERSION=0.4.3 +set YDF_VERSION=0.5.0 set BAZEL=bazel.exe set BAZEL_SH=C:\msys64\usr\bin\bash.exe set BAZEL_FLAGS=--config=windows_cpp20 --config=windows_avx2 diff --git a/yggdrasil_decision_forests/port/python/ydf/dataset/dataset.py b/yggdrasil_decision_forests/port/python/ydf/dataset/dataset.py index 138ab6ff..e7ad9aa4 100644 --- a/yggdrasil_decision_forests/port/python/ydf/dataset/dataset.py +++ b/yggdrasil_decision_forests/port/python/ydf/dataset/dataset.py @@ -136,7 +136,7 @@ def _add_column( column_data.dtype.type in [ np.object_, - np.string_, + np.bytes_, np.str_, ] or column_data.dtype.type in dataspec.NP_SUPPORTED_INT_DTYPE @@ -215,7 +215,7 @@ def _add_column( if column_data.dtype.type in [ np.object_, - np.string_, + np.bytes_, np.bool_, ] or np.issubdtype(column_data.dtype, np.integer): column_data = column_data.astype(np.bytes_) @@ -648,7 +648,7 @@ def infer_semantic(name: str, data: Any) -> dataspec.Semantic: ): return dataspec.Semantic.NUMERICAL - if data.dtype.type in [np.string_, np.bytes_, np.str_]: + if data.dtype.type in [np.bytes_, np.str_]: return dataspec.Semantic.CATEGORICAL if data.dtype.type in [np.object_]: diff --git a/yggdrasil_decision_forests/port/python/ydf/dataset/dataset_test.py b/yggdrasil_decision_forests/port/python/ydf/dataset/dataset_test.py index b7f8e131..6928432a 100644 --- a/yggdrasil_decision_forests/port/python/ydf/dataset/dataset_test.py +++ b/yggdrasil_decision_forests/port/python/ydf/dataset/dataset_test.py @@ -48,7 +48,6 @@ class GenericDatasetTest(parameterized.TestCase): (np.array([1], np.float64), Semantic.NUMERICAL), (np.array([1], np.bool_), Semantic.BOOLEAN), (np.array(["a"], np.bytes_), Semantic.CATEGORICAL), - (np.array(["a"], np.string_), Semantic.CATEGORICAL), (np.array(["a", np.nan], np.object_), Semantic.CATEGORICAL), ) def test_infer_semantic(self, value, expected_semantic): diff --git a/yggdrasil_decision_forests/port/python/ydf/dataset/dataspec.py b/yggdrasil_decision_forests/port/python/ydf/dataset/dataspec.py index 9a0d8b29..d33cfa80 100644 --- a/yggdrasil_decision_forests/port/python/ydf/dataset/dataspec.py +++ b/yggdrasil_decision_forests/port/python/ydf/dataset/dataspec.py @@ -50,7 +50,6 @@ np.float32: ds_pb.DType.DTYPE_FLOAT32, np.float64: ds_pb.DType.DTYPE_FLOAT64, np.bool_: ds_pb.DType.DTYPE_BOOL, - np.string_: ds_pb.DType.DTYPE_BYTES, np.str_: ds_pb.DType.DTYPE_BYTES, np.bytes_: ds_pb.DType.DTYPE_BYTES, np.object_: ds_pb.DType.DTYPE_BYTES, diff --git a/yggdrasil_decision_forests/port/python/ydf/utils/test_utils.py b/yggdrasil_decision_forests/port/python/ydf/utils/test_utils.py index 802ba242..e61f79ef 100644 --- a/yggdrasil_decision_forests/port/python/ydf/utils/test_utils.py +++ b/yggdrasil_decision_forests/port/python/ydf/utils/test_utils.py @@ -175,7 +175,7 @@ def test_almost_equal(a, b) -> Optional[str]: if a.dtype != b.dtype: return f"numpy array type mismatch: {a} != {b}" - if a.dtype.type in [np.string_, np.bytes_, np.str_]: + if a.dtype.type in [np.bytes_, np.str_]: if not np.equal(a, b).all(): return f"numpy array mismatch: {a} != {b}" else: diff --git a/yggdrasil_decision_forests/port/python/ydf/version.py b/yggdrasil_decision_forests/port/python/ydf/version.py index d066b205..e782e81c 100644 --- a/yggdrasil_decision_forests/port/python/ydf/version.py +++ b/yggdrasil_decision_forests/port/python/ydf/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -version = "0.4.3" +version = "0.5.0"