Keras Interview Questions and Answers
Question - 31 : - What is a confusion matrix?
Answer - 31 : - A confusion matrix, also known as an error matrix, is a specific table layout that allows visualization of the performance of an algorithm, typically a supervised learning one. Every row of the matrix represents the instances in an actual class while each column represents the instances in a predicted class, or vice versa. The name stems from the fact that it makes it easy to see whether the system is confusing two classes. Further, it can be considered as a special kind of contingency table, with two dimensions (“actual” and “predicted”), and identical sets of “classes” in both dimensions.
Question - 32 : - Why is there a need for keras?
Answer - 32 : - Keras is an API designed for human beings, not machines. Keras follows best practices for reducing cognitive load: it offers consistent & simple APIs, it minimizes the number of user actions required for common use cases, and it provides clear and actionable feedback upon user error.
Question - 33 : - What is flatten layer in keras?
Answer - 33 : - The role of the Flatten layer in Keras is super simple: A flatten operation on a tensor reshapes the tensor to have a shape that is equal to the number of elements contained in the tensor.
Question - 34 : - Is keras a library?
Answer - 34 : - Yes, Keras is an open-source neural-network library written in Python.
Question - 35 : - What is keras dropout?
Answer - 35 : - Dropout is a regularization technique for neural network models proposed by Srivastava, it is a technique where randomly selected neurons are ignored during training.
Question - 36 : - What are regularizers in keras?
Answer - 36 : -
keras.regularizers.l1(0.)
keras.regularizers.l2(0.)
keras.regularizers.l1_l2(l1=0.01, l2=0.01)
Question - 37 : - What are available constraints in keras?
Answer - 37 : -
- MaxNorm
- NonNeg
- UnitNorm
- MinMaxNorm
Question - 38 : - How can I use Keras with datasets that don’t fit in memory?
Answer - 38 : -
You should use the tf.data API to create tf.data.Dataset objects — an abstraction over a data pipeline that can pull data from local disk, from a distributed file system, from GCS, etc., as well as efficiently apply various data transformations.
For instance, the utility tf.keras.preprocessing.image_dataset_from_directory will create a dataset that reads image data from a local directory. Likewise, the utility tf.keras.preprocessing.text_dataset_from_directory will create a dataset that reads text files from a local directory.
Dataset objects can be directly passed to fit(), or can be iterated over in a custom low-level training loop.
model.fit(dataset, epochs=10, validation_data=val_dataset)
Question - 39 : - What is a Neural Network?
Answer - 39 : - Neural Networks replicate the way humans learn, inspired by how the neurons in our brains fire, only much simpler.
Question - 40 : - What Is a Multi-layer Perceptron(MLP)?
Answer - 40 : -
As in Neural Networks, MLPs have an input layer, a hidden layer, and an output layer. It has the same structure as a single layer perceptron with one or more hidden layers. A single layer perceptron can classify only linear separable classes with binary output (0,1), but MLP can classify nonlinear classes.
Except for the input layer, each node in the other layers uses a nonlinear activation function. This means the input layers, the data coming in, and the activation function is based upon all nodes and weights being added together, producing the output. MLP uses a supervised learning method called “backpropagation.” In backpropagation, the neural network calculates the error with the help of cost function. It propagates this error backward from where it came (adjusts the weights to train the model more accurately).