-1
$\begingroup$

I'm trying to predict the winner of a race, when given 2 sets of features. The data looks like this:

array([[[ 1.        ],
        [ 1.        ],
        [ 0.        ],
        [ 0.10447761],
        [ 0.18892762],
        [ 0.76190472],
        [ 1.        ],
        [ 0.0338983 ],
        [ 1.        ],
        [ 0.41789967]],

       [[ 1.        ],
        [ 1.        ],
        [ 0.        ],
        [ 0.10447761],
        [ 0.18892762],
        [ 0.        ],
        [ 0.74712646],
        [ 0.        ],
        [ 0.44444448],
        [ 0.53915548]],

 ....

The first 5 entries are features of racer #1 and entries 6-10 are the same features for racer #2. In addition, I have the results of the output neuron (0 or 1) which tells me which winner is expected to win.

I suggest the following model:

A 1D convolutional neural network with a kernel size of 5 and s stride size of 5. This is then followed by some flattening and fully connected layers. My results are very bad and I would like to know if there is conceptionally something wrong or if it's just the data.

My thoughts behind this is that it's like a convolution on an image, with a window size equivalent to the amount of features of each racer. On each of the two convolution, a filter set is then applied, which is equivalent for both of the two. The fully connected layer will then determine if the first or the second feature set is the one to be selected.

Any views if a convolutional layer can be used in that way are appreciated. Here the code snipped:

model = Sequential()
model.add(Conv1D(filters=64,
                 kernel_size=5,
                 strides=5,
                 input_shape=input_shape,
                 activation='relu'))
model.add(Dropout(0.2))
model.add(Flatten())
model.add(Dense(256, activation='relu', kernel_constraint=maxnorm(3)))
model.add(Dropout(0.2))
model.add(Dense(128, activation='relu', kernel_constraint=maxnorm(3)))
model.add(Dropout(0.2))
model.add(Dense(1, activation='softmax'))

model.compile(loss=sparse_categorical_crossentropy,
              optimizer=Adam(),
              metrics=['accuracy'])

model.fit(self.trainX,
          self.trainY,
          epochs=epochs,
          batch_size=1,
          verbose=1,
          callbacks=[tbCallBack, early_stop])
$\endgroup$
2
$\begingroup$

This methodology seems a bit strange and potentially overkill for the problem. I would try having your input just be a 5 dimensional vector that is the difference between racer 1 and racer 2 and have the output just be the result for racer 1 (or what every racer's features are being subtracted from the other racer's features.). From here you can just use a few fully connected layers (which is essentially what you are doing be having kernel's of size 5 anyway. I would also try some more traditional machine learning algorithms with this type of 1D input.

EDIT: since signs are important for the difference between your two racer features, do not use a relu as your activation function for this approach.

$\endgroup$
1
  • $\begingroup$ Indeed, using a sigmoid as output is essential $\endgroup$
    – Nickpick
    Nov 14 '17 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.