Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created July 29, 2020 13:16
Show Gist options
  • Save ntakouris/ecee79c942b6f74402499e8810c0befb to your computer and use it in GitHub Desktop.
Save ntakouris/ecee79c942b6f74402499e8810c0befb to your computer and use it in GitHub Desktop.
LABEL_KEY = 'lbl'
DENSE_FEATURES = ['a', 'b']
BINARY_FEATURES = ['c']
def preprocessing_fn(inputs: Dict[Text, Any]) -> Dict[Text, Any]:
outputs = {}
for feat in DENSE_FEATURES:
outputs[f'{feat}_xf'] = tft.scale_to_z_score(inputs[feat])
for feat in BINARY_FEATURES:
outputs[feat] = inputs[feat]
outputs[LABEL_KEY] = inputs[LABEL_KEY]
return outputs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment