With simple Regression and Classification Deep Learning models

Photo by William Iven on Unsplash

In Stack Overflow, GitHub, and elsewhere I have noticed a lot of questions related to custom metrics and custom losses in Keras. I have answered some questions related to those two topics in GitHub and Stack overflow. In this article, I want to explain different approaches to define custom metrics and losses in Keras.

In Keras, there are three different model APIs (Sequential API, Functional API, and Subclassing API) that are available to define deep learning models. Sequential and Functional model APIs have an almost similar approach in defining custom metrics and losses. Subclassing API is very different when compared…


Learn how to control and monitor saving entire mode or weights of model

Photo by Franki Chamaki on Unsplash

Keras with TensorFlow provides lots of functionality through callbacks. Keras has several callbacks to control and monitor ML models during training at some frequency (for example, at the end of each epoch/batch). Few of the important callbacks are listed below.

  • ModelCheckpoint
  • TensorBoard
  • EarlyStopping
  • LearningRateScheduler
  • ProgbarLogger
  • History
  • Lambda

In this article we will focus only on how to control and monitor saving of model weights or full model using ModelCheckpoint callback.

There are couple of ways to save Keras models (i) before training, (ii) during training, and (iii) after training. …


Saving entire model with custom metrics, custom layers

Saving architecture or weights or entire model

In Part I of this series, we have learned different approaches to save architecture only or save weights only or entire Keras model. However, we had covered only small part of saving entire model. In this article we will focus only on saving entire model when we have a custom metric/loss or a custom layer.

Outline of this article is as follows

  • Overview of saving and loading entire model
  • Saving entire model before or after training
  • Saving entire model during training
  • Saving entire model with a custom metric/loss
  • Saving entire model with…


Saving entire model or only architecture or only weights

Saving architecture or weights or entire model

In TensorFlow and Keras, there are several ways to save and load a deep learning model. When you have too many options, sometimes it will be confusing to know which option to select for saving a model. Moreover, if you have a custom metric or a custom layer then the complexity increases even more.

The main goal of this article is to explain different approaches for saving and loading a Keras model. If you are a seasoned machine learning practitioner, then most probably you know which option to select. …


Photo by Michal Ico on Unsplash

This article is focussed on the beginners and others who have extra time to read yet another article on Keras.

In this article, we will start with a broad overview of three different types of models (Sequential, Functional and Subclass) APIs that we can use to create Keras models to solve different use cases. There are other ways to create Deep Learning (DL) models. However, the scope of this article is to use simple data and simple models to demonstrate DL concepts for the beginners.

Dataset used : MNIST data

Platform/Libraries used: TensorFlow 2.2, Keras, and Python 3.x

Vishnuvardhan Janapati

Focussed on discovering the meaning behind data

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store