hello,
i have a little code that try to predict a vector of boolean values (output layer of neural network should produce that) but instead i have a vector of real numbers, what can i change in my code to do that?
my code contains this:
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(1,)),
tf.keras.layers.Dense(lgt, activation=‘relu’),
tf.keras.layers.Dense(lgt),
tf.keras.layers.Softmax()
])
model.compile(optimizer=“Adam”, loss=“mse”, metrics=[“mae”])
model.fit(traj_train_input,traj_train_output , epochs=100)
i train the model with data having output like : [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
and when i use the model i have output with reals, like that:
model.predict([5])
array([[0.00326481, 0.01493612, 0.00951447, 0.00575305, 0.00644396,
0.00941434, 0.00674182, 0.00505168, 0.03497467, 0.04624736,
0.25262812, 0.5352649 , 0.02151884, 0.01447066, 0.00728487,
0.01637338, 0.01011696]], dtype=float32)
basically what i want is 1 instead of 0.5352649 and other insignifiant little values like 0.00326481 to be at 0 to have a vector of booleans values
what can be changed in code? activation function ?? other?
Regards,
Damien