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
2 changes: 1 addition & 1 deletion doc/progress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Changelog
0.13.1
~~~~~~

* Add new contributions here.
* FIX #1198: Support numpy 1.24 and higher.


0.13.0
Expand Down
12 changes: 8 additions & 4 deletions openml/extensions/sklearn/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,14 +1252,16 @@ def _check_dependencies(self, dependencies: str, strict_version: bool = True) ->
def _serialize_type(self, o: Any) -> "OrderedDict[str, str]":
mapping = {
float: "float",
np.float: "np.float", # type: ignore
np.float32: "np.float32",
np.float64: "np.float64",
int: "int",
np.int: "np.int", # type: ignore
np.int32: "np.int32",
np.int64: "np.int64",
}
if LooseVersion(np.__version__) < "1.24":
mapping[np.float] = "np.float"
mapping[np.int] = "np.int"

ret = OrderedDict() # type: 'OrderedDict[str, str]'
ret["oml-python:serialized_object"] = "type"
ret["value"] = mapping[o]
Expand All @@ -1268,14 +1270,16 @@ def _serialize_type(self, o: Any) -> "OrderedDict[str, str]":
def _deserialize_type(self, o: str) -> Any:
mapping = {
"float": float,
"np.float": np.float, # type: ignore
"np.float32": np.float32,
"np.float64": np.float64,
"int": int,
"np.int": np.int, # type: ignore
"np.int32": np.int32,
"np.int64": np.int64,
}
if LooseVersion(np.__version__) < "1.24":
mapping["np.float"] = np.float
mapping["np.int"] = np.int

return mapping[o]

def _serialize_rv_frozen(self, o: Any) -> "OrderedDict[str, Union[str, Dict]]":
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"python-dateutil", # Installed through pandas anyway.
"pandas>=1.0.0",
"scipy>=0.13.3",
"numpy>=1.6.2,<1.24",
"numpy>=1.6.2",
"minio",
"pyarrow",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,10 @@ def test_serialize_strings_as_pipeline_steps(self):
self.assertEqual(extracted_info[2]["drop"].name, "drop")

def test_serialize_type(self):
supported_types = [float, np.float, np.float32, np.float64, int, np.int, np.int32, np.int64]
supported_types = [float, np.float32, np.float64, int, np.int32, np.int64]
if LooseVersion(np.__version__) < "1.24":
supported_types.append(np.float)
supported_types.append(np.int)

for supported_type in supported_types:
serialized = self.extension.model_to_flow(supported_type)
Expand Down