Help with resources for python plotting lectures

Hi.

I have just finished the week 3 assignment and it was really interesting. Kind of putting all the skills together. However, there are some clarifications I need to make to make sure I understand some coding before moving forward. Kindly find the snippets below:

code 1:
model_predict_r = lambda Xl: np.argmax(tf.nn.softmax(model_r.predict(Xl)).numpy(),axis=1)

question: what does “lambda XI:” do?

code 2:

import logging
logging.getLogger(“tensorflow”).setLevel(logging.ERROR)

question: I presume this code has to do with catching errors. But what errors?

code 3:

print(f"Finished lambda = {lambda_}")

question: the Iterate to find the optimal regularization value prints the value of “lambda” as indicated above. It will be great to be able to print out the “lambda” along with the last “loss value” and the lowest “loss value” along with the corresponding “epochs”. I.e., How do I access the “loss values”?

Lastly, I will really appreciate a video reference material to review Plotting, Tensorflow and Keras. Especially Plotting, because it is critical to understand what is happening under the hood of all these models as demonstrated in this lecture. I feel it is important to be versatile in pyplot.

What an exciting lecture series!! :smile:

Hello @alamindht,

I will only talk about 1 and 2.

For 1, the lambda expressions is a way for you to define a small function, and like any function it can have some input arguments, Xl is the first and only argument for the lambda function model_predict_r. Check this and this out for more examples.

For 2, first of all, Tensorflow uses the logging framework, and logging is a python package specialized in handling all levels of messages (including and not limited to ERROR). It takes care of ERRORS coded in this way → logger.error('error message'). Check this out to see that Tensorflow does use the logging framework. Check this out for the basic and the advanced tutorial on how to use logging framework.

For official Matplotlib and Tensorflow tutorials, which is not video reference you are asking for, you may check this post out.

Everything I said in above can be found by googling which is the quickest way if you need more examples and information.

Cheers,
Raymond

In addition to Raymond’s excellent information, I can comment on question 3:

The Model class in TF/Keras has a fit method and it supports “history” which records lots of information during training. I suggest you “stay tuned” and you will see examples of how to use that in Course 4, e.g. in the Transfer Learning with Mobilnet assignment in DLS C4 W2. If you want a preview, it is as Raymond says: google is your friend. Searching “keras model fit history” gets this StackExchange thread and lots of other “hits”.

In general, the material in C2 W3 is just the first introduction to TF/Keras. You will see many more examples of how to use more advanced features in C4 and C5 of DLS.

1 Like

It is also worth mentioning that there are lots more educational resources offered by DeepLearning.AI for learning more about TensorFlow. Once you finish DLS and want to go deeper on TensorFlow, have a look at the following Specializations: