Compare commits

...

2 Commits

Author SHA1 Message Date
JHV
6bbef46224
Merge d2da7e56ab into fb54d8b549 2023-05-22 17:36:53 -05:00
Jhv
d2da7e56ab Function TFModelInitializerBuilder._set_discretized_features refactored with the following changes:
removes a pair of brackets, making the intent slightly clearer
 Convert for loop into dictionary comprehension (dict-comprehension)
2023-04-04 21:30:15 +08:00

View File

@ -51,12 +51,13 @@ class TFModelInitializerBuilder:
if len(discretized_features) == 0:
return
num_bins = max([len(bins) for bins in discretized_features.values()])
num_bins = max(len(bins) for bins in discretized_features.values())
bin_boundaries_and_weights = {}
for feature_name in discretized_features:
bin_boundaries_and_weights[feature_name] = self._extract_bin_boundaries_and_weights(
bin_boundaries_and_weights = {
feature_name: self._extract_bin_boundaries_and_weights(
discretized_features[feature_name], num_bins)
for feature_name in discretized_features
}
tf_model_initializer["features"]["discretized"] = bin_boundaries_and_weights