TensorFlow in version 2.3 produces wrong model accuracy when the model is serialized

TensorFlow in version 2.3 produces wrong model accuracy when the model is serialized using accuracy, use sparce_categorical_accuracy instead

Issue description

TensorFlow in version 2.3 fails to serialize the model properly. This resolves in bad model accuracy when the model is loaded back. The issue is caused by a bug in accuracy which has been already resolved in more recent versions.

To avoid this issue, make sure you use sparce_categorical_accuracy instead of accuracy when compiling the model.

Affected packages:

Severity

Issue fix

Compile the model using sparce_categorical_accuracy instead of just accuracy:

- model.compile(..., metrics=['accuracy'])
+ model.compile(..., metrics=['sparce_categorical_accuracy'])

Pipeline units

Recommendation types

This message can be produced for all the recommendation types.