Issue
I have a model that takes in the boxscore for each NBA team in the 2015-2016 and then outputs if they won or lost (1/0). Here are some data points already numerically encoded.
(for reference the WL column gets dropped and becomes my label/target).
Now my problem is that my model gives predictions within a range (0.49-0.50~) instead of a 1 or 0. I have tried to mess around within .compile() as I believe thats most likely where my problem is but no dice. code below w/ some model predictions. appreciate any help and feedback
Solution
If you are doing binary classification, you don't want to use Mean Squared Error as your loss function. So first thing I'd change is the loss function to 'binary_crossentropy'
.
You could play around with the optimizer as well as I see you are using SGD, but I'd start with 'adam'
. I would also use 'relu'
for activation functions for input and hidden layers. Only have the output layer of 'sigmoid'
or 'softmax'
. All this stuff is hyperparamter tuning and testing that you can play with later, but the main thing here is your loss function. So you may want something like this.
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
or
model.compile(optimizer='sgd', loss='binary_crossentropy', metrics=['binary_accuracy'])
Lastly, you will not necessarily get 0s and 1s. You are going to get decimals, and you may need to figure out a thresh, default being 0.5.
So any output where output
y >= 0 and y < 0.5 -----> 0
v >= 0.5 and y <=1 -----> 1
Answered By - chitown88
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.