sparse categorical cross entropy python

# example
model = Sequential([
    Dense(16, input_shape=(1,), activation='relu'), # the relu activation takes the max between 0 and x
    Dense(32, activation='relu'),
    Dense(2, activation='sigmoid'), # the sigmoid activation convert the number into number between 0 to 1
])

# the loss function is the sparse categorical crossentropy
model.compile(Adam(lr=0.001), loss='sparse_categorical_crossentropy', metrics=['accuracyt'])

Here is what the above code is Doing:
1. We create a Sequential model.
2. We add a Dense layer with 16 neurons and an input_shape of (1,). The first parameter is the number of neurons in the layer. The second parameter is the shape of the input data.
3. We add another Dense layer with 32 neurons.
4. We add a final Dense layer with 2 neurons. This is our output layer. We use a sigmoid activation function to make sure the output is between 0 and 1.
5. We compile the model with an Adam optimizer and loss function of sparse categorical crossentropy. We also specify that we want to track accuracy during training.