Created
September 25, 2020 11:32
-
-
Save ntakouris/96a29d9fddaa0c0caaadc351b4a0ba13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow_transform as tft | |
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