I am building NN in Keras with overlapping class predictions. From what I understand, the 'sigmoid' activation function should return probability of belonging to a class. However, when I try to use model.predict(...), it just returns zeros or ones. Could you please tell me where I am going wrong and how I can get probabilitie of belonging to a class?
input_stock = Input(shape=input_shape,dtype='float32')
stock_data= Conv2D(32, (1,5), padding='same', activation='relu')(input_stock)
stock_data = MaxPooling2D((1,2),strides=(1,2))(stock_data)
stock_data= Conv2D(8, (1,5), padding='same', activation='relu')(stock_data)
stock_data = MaxPooling2D((1,5),strides=(1,5))(stock_data)
stock_data= Conv2D(8, (154,5), padding='same', activation='relu')(stock_data)
stock_data = MaxPooling2D((1,2),strides=(1,2))(stock_data)
stock_data=Flatten()(stock_data)
stock_data=Dropout(.5)(stock_data)
output_layer = Dense(maxnumassets, activation='sigmoid')(stock_data)
model = Model(inputs=input_stock, outputs=output_layer)
return model
Output of model.predict (there are 150 classes), looks like below.
array([[1., 1., 0., 0., 1., 1., 0., 1., 0., 0., 0., 1., 0., 1., 1., 1.,
0., 0., 1., 1., 0., 0., 1., 0., 0., 1., 0., 0., 0., 0., 1., 0.,
0., 1., 0., 0., 1., 1., 1., 1., 0., 1., 1., 0., 0., 0., 0., 1.,
0., 1., 1., 1., 1., 1., 0., 0., 0., 0., 1., 1., 1., 0., 0., 1.,
0., 0., 0., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 1., 1., 1.,
1., 1., 0., 0., 1., 1., 1., 0., 0., 0., 1., 0., 1., 0., 0., 0.,
1., 1., 1., 0., 0., 0., 1., 0., 1., 0., 1., 1., 1., 0., 1., 1.,
0., 0., 1., 1., 1., 0., 0., 0., 0., 1., 1., 0., 1., 1., 1., 1.,
0., 0., 0., 1., 1., 0., 0., 0., 1., 0., 1., 0., 1., 0., 1., 1.,
1., 1., 0., 0., 0., 0.]], dtype=float32)'''
Dimensions of the data are as follows:
train (715, 150, 100, 2)
ytrain (715, 150)
xtest (80, 150, 100, 2)
ytest (80, 150)