#499·DeepCTR

How to get multi output for DeepFM?

Author: jonathonbirdCreated Nov 4, 2022Updated Mar 28, 2023
Labelsquestion

I'm trying to use DeepFM to predict scores for the world cup, which has 2 outputs the [left score, right score]. For the y values, the model takes in a (35245, 2) shape, and runs, but only gives one value for the output. Basically I'm asking how to set the amount of nodes in the output layer to 2 instead of 1.

Y_train looks like this:

   home_score  away_score
         0.0         1.0
         1.0         1.0
         0.0         1.0
         1.0         2.0

The model is:

 model = DeepFM(linear_feature_columns,dnn_feature_columns,task='regression')
 model.compile("adam", "mean_squared_error",
               metrics=['mean_squared_error'], )
history = model.fit(train_model_input, Y_train.values,
                    batch_size=256, epochs=10, verbose=2, validation_split=0.2, )
pred_ans = model.predict(test_model_input, batch_size=256)

Using google colab