@@ -76,22 +76,11 @@ def serialize_pre_module(self, pre_module):
76
76
:type pre_module: sklearn.preprocessing
77
77
:return: pymilo serialized pre_module
78
78
"""
79
- _type = get_sklearn_type (pre_module )
80
- associated_class = SKLEARN_PREPROCESSING_TABLE [_type ]
81
- if _type == "OneHotEncoder" :
82
- return {
83
- "pymilo-bypass" : True ,
84
- "pymilo-preprocessing-type" : _type ,
85
- "pymilo-preprocessing-data" : {
86
- "sparse_output" : pre_module .sparse_output if has_named_parameter (associated_class , "sparse_output" ) else pre_module .sparse
87
- }
88
- }
89
-
90
79
gdst = GeneralDataStructureTransporter ()
91
80
gdst .transport (pre_module , Command .SERIALIZE , False )
92
81
return {
93
82
"pymilo-bypass" : True ,
94
- "pymilo-preprocessing-type" : _type ,
83
+ "pymilo-preprocessing-type" : get_sklearn_type ( pre_module ) ,
95
84
"pymilo-preprocessing-data" : pre_module .__dict__
96
85
}
97
86
@@ -105,16 +94,7 @@ def deserialize_pre_module(self, serialized_pre_module):
105
94
:return: retrieved associated sklearn.preprocessing module
106
95
"""
107
96
data = serialized_pre_module ["pymilo-preprocessing-data" ]
108
- _type = serialized_pre_module ["pymilo-preprocessing-type" ]
109
97
associated_type = SKLEARN_PREPROCESSING_TABLE [serialized_pre_module ["pymilo-preprocessing-type" ]]
110
-
111
- if _type == "OneHotEncoder" :
112
- if has_named_parameter (associated_type , "sparse_output" ):
113
- return associated_type (
114
- sparse_output = serialized_pre_module ["pymilo-preprocessing-data" ]["sparse_output" ])
115
- elif has_named_parameter (associated_type , "sparse" ):
116
- return associated_type (sparse = serialized_pre_module ["pymilo-preprocessing-data" ]["sparse_output" ])
117
-
118
98
retrieved_pre_module = associated_type ()
119
99
gdst = GeneralDataStructureTransporter ()
120
100
for key in data :
0 commit comments