DLS Course 1 Week 2 warning when running the logistic regression model

If you are seeing 93% training accuracy and 80% test accuracy (as you showed in the one example), that would qualify as overfitting. And it would also not be too surprising if the model did not do very well on images not in either the training or test set.

But before we can draw too many conclusions about what is going on, it would help to have a bit more information. What is the total size of your training and test datasets? Note that 200 iterations is not very many in the grand scheme of things. Of course everything is situation dependent, but typically in the assignments here the iteration counts are at least in the range of 10^3 and as high as 10^4 in some cases.

Also note that Logistic Regression is not very powerful for general purpose image recognition tasks. Before investing a lot more effort in getting LR to work well with your example, it might be better to wait until you’ve seen the material in Week 4 of DLS Course 1 and try comparing the performance of LR to that of a 3 or 4 layer network like the ones Prof Ng shows us in Week 4.

Also note that the cat recognition task that we have here is really difficult with the small datasets that we have. 209 training samples and 50 test samples is unrealistically small for a task this complex. It’s kind of amazing that we get as good results as we do, but I suspect that the datasets were carefully “curated” to make that possible within the severe memory limitations of the online notebook environment. Here’s another thread that shows some experiments with rebalancing the 209/50 datasets that seems to support the “careful curation” theory.