Skip to content

Commit 2d1bb1d

Browse files
committed
update profiler
1 parent 5826eca commit 2d1bb1d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dsbox/datapreprocessing/cleaner/data_profile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Hyperparams(hyperparams.Hyperparams):
7878

7979

8080
class ProfilerParams(params.Params):
81-
mapping: typing.List
81+
mapping: str
8282

8383

8484
class Profiler(UnsupervisedLearnerPrimitiveBase[Input, Output, ProfilerParams, Hyperparams]):
@@ -127,7 +127,7 @@ def __init__(self, *, hyperparams: Hyperparams) -> None:
127127
self._specified_features = hyperparams["metafeatures"] if hyperparams else default_metafeatures
128128
self._input_data = None
129129
self._fitted = False
130-
self._mapping = {}
130+
self._mapping = ""
131131

132132
def get_params(self) -> ProfilerParams:
133133
if not self._fitted:
@@ -310,7 +310,7 @@ def fit(self, *, timeout: float = None, iterations: int = None) -> CallResult[No
310310

311311
inputs = self._relabel_categorical(inputs)
312312
# remember these mapping results
313-
self._mapping = inputs.metadata.to_json_structure()
313+
self._mapping = json.dumps(inputs.metadata.to_json_structure())
314314
self._fitted = True
315315
return CallResult(None, has_finished=True, iterations_done=1)
316316

@@ -391,7 +391,7 @@ def _update_semantic_types(self, inputs: Input) -> Input:
391391
"""
392392
function that used fitted metadata record to add back the metadata
393393
"""
394-
for each_memo in self._mapping:
394+
for each_memo in json.loads(self._mapping):
395395
each_selector = each_memo["selector"]
396396
if 'semantic_types' in each_memo["metadata"] and "name" in each_memo["metadata"]:
397397
each_updated_semantic_types = tuple(each_memo["metadata"]['semantic_types'])

0 commit comments

Comments
 (0)