I have a tensorflow dataset:
data = tf.data.experimental.make_csv_dataset(r"data.tsv.gz",
field_delim="\t",
compression_type="GZIP",
batch_size=1000,
label_name="Y",
num_epochs=1)
and I want to normalize column X1, I tried this way:
columns = []
x1 = tf.feature_column.numeric_column('X1', normalizer_fn=lambda x: (x - xMean) / xStd)
columns.append(x1)
l = tf.keras.layers.DenseFeatures(columns)
nn = tf.keras.Sequential()
nn.add(l)
nn.compile(optimizer="Adam", loss="binary_crossentropy", metrics=[tf.keras.metrics.AUC(name='auc')])
nn.fit(data, epochs=5)
but I don't know how to compute mean and std.. How can I get one column from my dataset and compute mean and std? Or maybe is there some normalization function in tensorflow?