Open this if you want to see how ChatGPT built all my code.

Disclaimer: I build Machine Learning models for a living. I know what questions to ask, and I can spot mistakes in ChatGPT's suggestions. ChatGPT is an incredible tool, but you must understand how to use it properly. Let's get started!

I want to build a neural network to solve the MNIST problem using Keras. I asked ChatGPT to start things off for me. The result worked flawlessly without having to change anything. This was a great start!

ChatGPT used Categorical CrossEntropy as the loss function. I asked it to use a different one. The updated code also works. Notice how it changed the loss function, but it also dropped the categorical transformation of labels. This is key for the new loss function work!

ChatGPT's code uses fully-connected layers. But I want to use convolutional layers. ChatGPT modified the code and added a Conv2D and a MaxPooling layer.

I need to evaluate the final model, so I asked ChatGPT to write code using the test set. The result and explanation look great!

The model uses the entire test set as validation data during training. Let's ask ChatGPT to change that to 20% of the train data. This is good stuff! (By the way, every answer from ChatGPT comes with a full explanation. I'm not including it here to keep screenshots simple.)

I want smaller batches and run the code for fewer epochs. Of course, I don't need ChatGPT for this, but I did not want to change my code without updating ChatGPT's context. That's why I asked.

Let's now draw a plot of the training and testing losses during the training process. ChatGPT explained that I need to change the line that fits the model to capture its result value (history.) That was neat! The plot works and looks good!

I need to show a few examples from the dataset, so let's ask ChatGPT to write code to print a combination of images and labels. The code was also perfect. You can see the plot with 20 images attached.

Something useful whenever you build a model is to take a look at its structure. Let's ask ChatGPT how I can do that.

Okay, the summary of the model is helpful, but I'd rather see a plot showing the model's structure. Let's ask:

This is looking good! Let's now get ready to deploy this model. Let's ask ChatGPT to save the model to disk.

Now, I want to create a class that uses the saved model to make predictions. This is an interesting prompt, and the solution is perfect.

Let's now write an example that uses the Predictor class to predict the label of 10 random images:

To finish this, let's display a confusion matrix. I like the styles that ChatGPT used!

Here is a link to all of the code that ChatGPT produced: This is going to be such an exciting year!

If you enjoy content like this, follow me @svpino.