I trained a model which contains both the time series and I added additional layers which uses non time series data as well, however, for the predict function, I got the error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
I checked the data, and it seems to be correct with float dtypes.
This was the function that I used to generate the predictions:
preds = model.predict(x_val, x_val_cons.values)
Also, this is the architecture of my model:
def create_nbeat_mlp(num_columns, num_labels, lookback, horizon, hidden_units, dropout_rates, batch_size, ls=1e-2, lr=1e-3, ):
nbeats = NBeatsModel(model_type = 'generic', lookback = lookback, horizon = horizon,
learning_rate = lr, batch_size = batch_size,
num_generic_neurons = hidden_units[0]) # set as default
nbeats.build_layer()
time_input = keras.layers.Input(shape = (lookback * horizon, ))
x_nb = nbeats.model_layer(time_input)
xcons = keras.layers.Input(shape = (num_columns, ))
x = keras.layers.Concatenate()([xcons, x_nb])
x = tf.keras.layers.BatchNormalization()(x)
x = tf.keras.layers.Dropout(dropout_rates[0])(x)
for i in range(1, len(hidden_units)):
x = tf.keras.layers.Dense(hidden_units[i])(x)
x = tf.keras.layers.BatchNormalization()(x)
x = tf.keras.layers.Activation('swish')(x)
x = tf.keras.layers.Dropout(dropout_rates[i])(x)
out = tf.keras.layers.Dense(num_labels, name = 'action')(x)
model = tf.keras.models.Model(inputs = [time_input, xcons], outputs = out)
model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=lr),
loss = {'action' : tf.keras.losses.MeanSquaredError()},
metrics = {'action' : tf.metrics.MeanSquaredError(name = 'mse')})
return model
I trained a model which contains both the time series and I added additional layers which uses non time series data as well, however, for the predict function, I got the error:
I checked the data, and it seems to be correct with float dtypes.
This was the function that I used to generate the predictions:
preds = model.predict(x_val, x_val_cons.values)
Also, this is the architecture of my model:
thanks