Data Science Asked by LHS on April 24, 2021
I have a small data set where I track 4 variables across 4 time periods, 1 categorical and 1 numerical variable. Below is picture of data set that I am using:
Below is picture of my data set (to show the format; my X and Y is the same cause I am trying to learn how GRUs work and am not concerned much about the model accuracy).
Here is my GRU model code. It runs well and it predicts ok.
inputs = Input(shape=(4,2))
x = Bidirectional(GRU(256, activation='relu'))(inputs)
x = Dense(32, activation='relu')(x)
outputs = Dense(4)(x)
model = Model(inputs=inputs, outputs=outputs, name="func_loss_res")
model.summary()
plot_model(model, "my_first_model_with_shape_info.png", show_shapes=True)
model.compile(optimizer='adam', loss='mse')
my_callbacks = [tf.keras.callbacks.EarlyStopping(patience=10)]
print(X_train)
history = model.fit(X_train, Y_train, epochs=250, validation_split=0.25, batch_size=4, callbacks=my_callbacks)
My question is, if I were to Embed the cat1 variable say with 5 unique values and embedding size of 3 (I want to scale this model with 146 categories later and add 22 numerical variables), how can I concatenate cat1 and num1 to make it work for my given GRU? Any assistance is highly appreciated!
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP