Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created July 8, 2020 12:56
Show Gist options
  • Save ntakouris/33da3a79fd899a73b101f3cafb3817ee to your computer and use it in GitHub Desktop.
Save ntakouris/33da3a79fd899a73b101f3cafb3817ee to your computer and use it in GitHub Desktop.
def preprocessing_fn(inputs):
"""Preprocess input columns into transformed columns."""
x = inputs['x']
y = inputs['y']
s = inputs['s']
x_centered = x - tft.mean(x)
y_normalized = tft.scale_to_0_1(y)
s_integerized = tft.compute_and_apply_vocabulary(s)
x_centered_times_y_normalized = (x_centered * y_normalized)
return {
'x_centered': x_centered,
'y_normalized': y_normalized,
's_integerized': s_integerized,
'x_centered_times_y_normalized': x_centered_times_y_normalized,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment