From In Tensorflow for serving a model, what does the serving input function supposed to do exactly this article, I found out that 'serving input function' is for telling the model what data it has to get from the user for prediction when the model is exported. 'train input function' will refer to train input which train data would be given.
But I can't understand why these two functions are separated. I think most of the time, train data shapes and prediction data shapes would be the same. Is there any way to receive prediction data through 'train input function' instead of 'serving input function'?
I'm asking this question because I have some preprocess done in my 'train input function' but I can't to any data processing in the 'serving input function' since there is no input data given. I had no problem when there was no preprocess but what I need to do here is to make my csv input data into [batch size x window size x number of features].
This is some parts of my train input and input function:
def generate_input_fn(file_names, mode, skip_header_lines=5, batch_size = None, windows_size = None):
column_names=((tf.contrib.timeseries.TrainEvalFeatures.TIMES,)
+ (tf.contrib.timeseries.TrainEvalFeatures.VALUES,) * 32)
reader = tf.contrib.timeseries.CSVReader(filenames=file_names,
column_names=column_names,
skip_header_lines=skip_header_lines)
input_fn = tf.contrib.timeseries.RandomWindowInputFn(
reader,
batch_size=batch_size,
window_size=windows_size,
)
return input_fn
train_input = generate_input_fn(
hparams.train_files,
mode = tf.estimator.ModeKeys.TRAIN,
batch_size=hparams.train_batch_size
)
I'm new with Tensorflow so if I'm getting something wrong, please adjust it.
PS. Any suggestions on how to deal with multivariate time series data??