Wine quality classification using MLPs in TensorFlow

MLP can be used to do classification tasks as well. We can reuse the MLP class from the previous section with minor modifications to perform the task of classification.

We will need to make the following two major changes:

  • The target in the case of classification will be one-hot encoded
  • The loss function will now be categorical cross-entropy loss: tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=self.y_hat, labels=self.y))

So let's now see the complete code, which is also available at GitHub in the file MLP_classification. We will be classifying the red wine quality, to make it convenient, we use only two wine classes:

  1. We import the necessary modules namely: TensorFlow, ...

Get Hands-On Artificial Intelligence for IoT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.