How can we draw such an image and judge the accuracy of the algorithm

as the title
Snipaste_2022-07-04_18-09-04

Did you by chance create this thread under DLS instead of MLS?

nope, I don’t have impact

Is your post related to machine learning specialization?

Yes, I need to use the cost function to determine whether the algorithm is correct, and the course taught has also said that it is best to judge whether the algorithm is suitable by image values and so on. I want to know how this image is visualized, so that it is easier to judge

And I focus it on deeplearining course, I did not use the newest machine learning course .This community include ML?

@boe Please provide a link to the lecture / assignment that talks about the image in the post.

ok,in exercise 7 Planar Data Classification with One Hidden Layer | Coursera

The notebook shows 2 animated images.
The one on the left shows how the weight updates using a good learning rate helps converge the the minimum loss.
The image on the right shows what happens when learning rate is high. The updates make long steps and keep jumping around the minimum.

When you visualize iterations in x-axis and loss in y-axis, you want loss to go down with increase in iterations and not bounce around.

Does this help?

Oh, maybe you misunderstood what I meant, I was wondering how to draw these two images using Python

Hey @boe,

If by “this community”, you refer to the Discourse community of DeepLearning.AI, then yes, there is an individual category for the learners of Machine Learning Specialization, just like there is an individual category for the learners of Deep Learning Specialization.

As you might have already seen from the markdown cell, these are gifs (perhaps made in separate visual-specific software), saved as gifs and simply rendered in this notebook. Personally, I have never created a gif (or an animated visualization) using python and/or any python packages.

However, a quick search in matplotlib will give you this. So, I guess you can create individual images depicting the loss at various parameter values, which you can easily do while iterating in gradient descent. Once created, you can store these images somewhere, and then once the algorithm has converged or reached a maximum number of iterations, you can simply create an animated image out of the stored ones. I hope this helps.

Regards,
Elemento