Lambda Functions in Python
In Python, functions are objects: they can be assigned to variables, can be returned from other functions, stored in lists or dicts and passed as parameters for other functions. Consider, for example, the map() built-in function. Its syntax is map(function, iterable) and it is used to handily apply function...
How to convert JSON to Python Object
Python's json library has many utilities for encoding and decoding data in JSON format. In particular, the json.load() method decodes an JSON read as a file, and the json.loads() decode an JSON read as a string. In general, when decoding JSON files, the data is converted to Python...
Guide to Writing Custom TensorFlow/Keras Callbacks
Suppose you want your Keras model to have some specific behaviour during training, evaluation or prediction. For instance, you might want to save your model at every training epoch. One way of doing this is using Callbacks. In general, Callbacks are functions that are called when some event happens, and...
Understanding TensorFlow's @tf.function Decorator
Improving the performance of a training loop can save hours of computing time when training machine learning models. One of the ways of improving the performance of TensorFlow code is using the tf.function() decorator - a simple, one-line change that can make your functions run significantly faster. In this...