How to input data into Keras? Specifically what is the x_train and y_train if I have more than 2 columns?

后端 未结 1 1425
遥遥无期
遥遥无期 2021-02-09 12:29

How can I input data into keras? What is the structure? Specifically what is the x_train and y_train if I have more than 2 columns?

This is the data I want to input:

相关标签:
1条回答
  • 2021-02-09 12:59

    It all depends on your need.

    It looks like that you want to predict the winner based on the parameters shown in column A - N. Then you should define input_dim to be 14, and X_train should be an (N,14) numpy array like this:

    [
       [9278,  37.9, ...],
       [18594, 36.3, ...],
       ...
    ]
    

    It seems that your prediction set only contains 2 items ( 2 president candidates LOL), so you should encode the answer Y_train in an (N,2) numpy array like this:

    [
       [1, 0],
       [1, 0],
       ...
       [0, 1],
       [0, 1],
       ...
    ]
    

    where [1,0] indicates that Barack Obama is the winner and vice versa.

    0 讨论(0)
提交回复
热议问题