Support for columns contains only numbers. #737
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the case where the column names contain only numbers, typically when scaling the data, the code doesn't work well because the first value of the variable will be a numeric value, not a string, to which you cannot append a string later.
The executed commands are:
synthesizer = SingleTablePreset(
metadata,
name='FAST_ML'
)
synthesizer.fit(
data=test_df
)
synthetic_data = synthesizer.sample(
num_rows=500
)
synthetic_data.head()
The output:
File [~/GitHub/ml_network_analysis_experiments/.venv/lib/python3.9/site-packages/rdt/transformers/base.py:367](https://file+.vscode-resource.vscode-cdn.net/Users/**********/GitHub/ml_network_analysis_experiments/~/GitHub/ml_network_analysis_experiments/.venv/lib/python3.9/site-packages/rdt/transformers/base.py:367), in BaseTransformer._set_seed(self, data) 365 hash_value = self.columns[0] 366 for value in data.head(5): --> 367 hash_value += str(value) 369 hash_value = int(hashlib.sha256(hash_value.encode('utf-8')).hexdigest(), 16) 370 self.random_seed = hash_value % ((2 ** 32) - 1) # maximum value for a seed
This is why this modifications are needed.
self.column_prefix = '#'.join(map(str, self.columns))
and
hash_value = str(self.columns[0])