Using feature columns on 3D data: How to avoid having 750+ input layers ?


I’m trying to use Tensorflow to predict the outcome of a sport contest. What I have for every sample is the context of the competition (weather, type of stadium, …) and the competition history for every competing team.

Here is an overview of the data of every sample:

Context Teams History
CompetitionData [[CompetitionData], [CompetitionData]] (for every team, the past competition data and their result (win/lose/ranking)

I’m going to try to develop a Learning to Rank System, where given the context and every team history, predict the final ranking.

I think that feature columns are useful in this case, as they can ease the processing of the Competition Data. However, I can’t find a way to reuse the feature column code across all Competition data dimensions. The ideal would be to reuse the DenseFeatures layers across all competition data, but it doesn’t seems to work as tf requires the data to be of dict type to be fed to the Densefeature layers, which needs to be passed one by one trough an input layer to be correctly inputted.

I have also tried this:

history_input = tf.keras.layers.DenseFeatures([info_columns, info_columns2, info_columns3, age])

statics_hist = {
‘rapport’: Input((1,), dtype=tf.dtypes.int32, name=”rapport”),
‘weight’: Input((1,), dtype=tf.dtypes.int32, name=”weight”),
‘age’: Input((1,), name=”age”),
‘first’: Input((1,), dtype=tf.dtypes.int32, name=”first”),
‘stadium’: Input((1,), name=”stadiul”, dtype=tf.dtypes.string)
test = [stack([history_input(statics_hist) for _ in range(NB_RACE_HISTORY)], axis=1) for __ in range(MAX_NUMBER_PLAYERS)]
test = stack(test, axis=1)
But as I have 15 players with each 10 competition history of several columns, this gives me 750+ input layers, which can’t be the right way to go.

I have thought about flattening the data beforehand, but then I would lose the ability to run an LSTM trough a player history, which is important to modelize his current performance.

I’m not really sure of the right way to go, could anyone point me in the right direction ?

submitted by /u/Wats0ns
[visit reddit] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *