Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the output of the program below? Assume that it is being executed using Python 3.x environment. Will the session close automatically or remain open at the end of the program.

Answer»

Gradient DESCENT is a first-order iterative optimization algorithm for finding the minimum of a FUNCTION. To find a local minimum of a function using gradient descent, one takes steps proportional to the negative of the gradient (or approximate gradient) of the function at the current point. If, instead, one takes steps proportional to the positive of the gradient, one APPROACHES a local maximum of that function; the procedure is then known as gradient ascent.

  1. The steps to use gradient descent algorithm is as follows:
  2. Initialize random weight and bias
  3. Pass an INPUT through the network and get values from the output layer
  4. Calculate error between the ACTUAL value and the predicted value
  5. Go to each neurons which contributes to the error and change its respective values to reduce the error
  6. Reiterate until we find the best weights of the network

Below is an illustrative diagram of gradient descent on a series of level sets.

2.

What is Artificial Neural Network (ANN and what is a perceptron algorithm? Mention few R packages for ANNs.

Answer»

Option C is the correct answer.

Softmax function is of the form in which the sum of probabilities over all i sum to 1.

If we take an input of [1, 2, 3, 4, 1, 2, 3], the softmax of that is [0.024, 0.064, 0.175, 0.475, 0.024, 0.064, 0.175]. The output has most of its weight where the '4' was in the original input. This is what the function is normally used for: to highlight the largest VALUES and suppress values which are significantly below the maximum value. However please note that, softmax is not scale invariant, so if the input were [0.1, 0.2, 0.3, 0.4, 0.1, 0.2, 0.3] (which sums to 1.6) the softmax would be [0.125, 0.138, 0.153, 0.169, 0.125, 0.138, 0.153]. This SHOWS that for values between 0 and 1 softmax, in FACT, de-emphasizes the maximum value (note that 0.169 is not only less than 0.475, it is also less than the initial proportion of 0.4/1.6=0.25)

If we execute below code snippet in Python 3.x, then we can get the desired output for the example of [1,2,3,4,1,2,3] that we mentioned above.

3.

What is deep learning platform and deep learning library? Explain with examples from each.

Answer»

<P>Option C would be the CORRECT answer.

The size of the convoluted matrix is GIVEN by C = ((I-F+2P)/S)+1, where

  • C is the size of the convoluted matrix.
  • I is the size of the input matrix.
  • F is the size of the FILTER matrix.
  • P is the padding applied to the input matrix.
  • S is the stride applied.

Here I = 12, F = 3, P = 0, S = 1

Therefore the answer is 10 X 10 matrix.

4.

Image classification and taggingSentiment analysisFace detectionVideo recognitionSpeech recognition

Answer»

The output will be as follows:

c =: 8 d =: 4

Operations are nodes that REPRESENT the mathematical operations over the tensors on a graph. These operations can be any kind of functions, like ADD and subtract tensor used here. tf.constant function DEFINES the values to variables a and b.

Then c and d performs add and subtract operations RESPECTIVELY based on the GIVEN value in the session. Hence it outputs desired result and prints it.

5.

Which of the following are use cases of machine vision. Select all that apply.

Answer»

Operations are nodes that represent the MATHEMATICAL operations over the tensors on a graph. These operations can be any KIND of functions, like add and subtract tensor or maybe an activation function.

ALL of these four - tf.constant, tf.matmul, tf.add, tf.nn.sigmoid are operations in TENSORFLOW. These are like functions in python but operate directly over tensors and each ONE does a specific thing.

While others are straight forward and SIMPLE, tf.nn.sigmoid is an activation function, it's a little more complicated, but this function helps learning models to evaluate what kind of information is good or not.

6.

What is a Convolutional Neural Network (CNN)? Describe with a diagram about its architecture and typical layer components. Does it perform dimensionality reduction – if yes, which layer/component?

Answer»

Answer: 7.0

The tf.float32 will define a 32 bit floating point. The first line creates a placeholder and then it is multiplied by 2 and KEPT in second variable as b.

Now we need to define and run the session, but since we created a "hole" in the model to pass the data, when we initialize the session we are OBLIGATED to pass an argument with the data, otherwise we would GET an error.

To pass the data into the model we call the session with an extra argument feed_dict in which we should pass a dictionary with each placeholder name followed by its respective data, like the way it was shown in above code snippet.

7.

d) All of the above.

Answer»

Answer: 0, 1, 2

The RESULT will print 0 to 2.

The variable is first defined using tf.Variable() and it is initialized with 0. Then in order to counter from the initial value, tf.assign() function is used. It TAKES two arguments – the reference_variable as 1st argument and value_to_update as a 2nd argument.

Variables must be initialized by running an INITIALIZATION operation after having launched the graph. We first have to add the initialization operation to the graph.

We then START a session to run the graph, first initialize the variables, then print the initial value of the state variable, and then run the operation of updating the state variable and printing the result after each update.

8.

c) The gradient is calculated multiplying two numbers between 0 and 1 

Answer»

Answer: [5]

The answer will be [5].

The program creates a GRAPH by using source operations. These source operations will pass their INFORMATION to other operations which will execute computations.

Here in ORDER to create TWO source operations which will output numbers, two constants are defined in a and b. After that, function tf.add() adds two elements and stores the calculation in c.

The with block then prints the result by opening the session.

After running the with block, session will CLOSE automatically.

9.

b) With backpropagation, the gradient becomes smaller as it works back through the net 

Answer»

Artificial Neural Network (ANN) can be of two main categories: Feed-FORWARD neural networks and recursive neural networks. They are flexible to many possible VARIATIONS based on – the learning rule, the inference rule and the architecture.

Feed forward neural network can be described as per below diagram:

Perceptron algorithm is a fundamental computational unit at heart of the Deep learning model. It’s a SUPERVISED learning algorithm for binary classification.

There are many packages available for ANNs. In R, some of the packages are nnet, neuralnet, RSNNS, deepnet, darch, caret, RNN, Autoencoder, RcppDL, MXNetR and OTHERS for more specific tasks.

10.

a) Training is quick if the gradient is large and slow if it is small

Answer»

A DEEP learning platform PROVIDES a set of tools and an interface for building custom deep nets. Typically they provide a user with a selection of deep nets to choose from, along with the ability to integrate data from different sources, manipulate data, and manage models through user interface. Some platforms also help with performance if a net needs to be TRAINED with a large dataset. The platform is typically an out of the box application that lets us configure a deep net’s hyper-parameters through an intuitive UI. With a platform, we don’t need to know anything about coding aspects in order to use tools. The downside is that we are constrained by the platform’s selection of deep nets as well as the configuration options. However, for somebody to quickly deploy a deep net, a platform could be the best way to go. Deep learning platforms come in two different forms – software platform and full platform. Examples are H2O.ai, Data Graph etc

Library is a set of functions and modules that we can call through our own programs in order to perform certain tasks. Deep net libraries gives us lot of FLEXIBILITY with net selection and hyper-parameter configuration. For example: there are not many platforms that let us build a Recursive Neural Tensor Net (RNTN), however we can code our own with the APPROPRIATE deep net library. The obvious downside here is the coding experience required to use them. However if we need flexibility, these are great options. Examples are TensorFlow, Theano, Caffe, deeplearning4j, torch etc.

11.

Please select that apply from below reason(s). Explain in brief why is vanishing gradient a problem?

Answer»

Image classification and tagging, Face detection and Video recognition are use CASES of machine vision. So option “i”,”iii”,”iv” are correct answers.

Image search systems use deep learning for image classification and automatic tagging, which allows images to be accessible through a STANDARD search query. For example: companies such as Facebook use deep nets to scan pictures for faces at many different angles, and then label the face with the proper name.

Face detection is a computer technology being USED in a variety of applications that identifies human faces in digital images. Deep nets are also used to recognize objects within images which ALLOW for images to be searchable based on the objects within them.

Video recognition systems are important tools for driverless cars, remote robots, THEFT detection etc. Typically video is an ordered set of frames of same resolution. It has got two parts – video stream and video sequence. Video stream is an ongoing video for online real-time procession. Video sequence is a video of fixed length.

12.

*RNTN – Recursive Neural Tensor Network, *MLP – Multi Layer Perceptron, *RELU – Rectifier Linear Unit

Answer»

A convolutional neural network (CNN) is a type of artificial neural network USED in image recognition and processing that is specifically designed to process pixel data. In deep LEARNING, a CNN is a class of deep neural nets, most commonly applied to analysing visual imagery. CNNs use a variation of multilayer perceptrons designed to require minimal pre-processing. Convolution is the process of filtering through the image for a specific pattern.

CNNs typical has the following layers other than Input and Output layers –

  • Convolutional Layer (CONV)
  • Rectifier Linear Unit Layer (RELU)
  • Pooling Layer (POOLING)

There is also a fully CONNECTED layer (FC) at the end prior to output layer, in order to EQUIP net with the ability to classify data samples.

A fundamental architecture comprising of all layers for a CNN can be described in the image below. This is an illustrative structure and layers can be used differently to solve a specific problem based on a context or situation.

Yes, CNN does perform dimensionality reduction. Pooling layer is used for this.

13.

Side ASide BUnlabelled DataText ProcessingUnsupervised LearningImage RecognitionObject RecognitionSpeech RecognitionClassificationRecurrent Net (RNTN)Restricted Boltzmann Machine (RBM)Deep Belief Nets (DBN)Convolutional Neural Nets (CNN)MLP/RELUAutoencoders

Answer»

All of the above / Option d is CORRECT option.

Now coming to second part of question for the explanation, below is described:

With a method CALLED BACKPROPAGATION, we run into a problem called vanishing gradient or sometimes the exploding gradient. When that happens, training takes too long and accuracy really suffers.

For example, when we are training a neural net, we are constantly calculating a cost value. The cost is TYPICALLY difference between net’s predicted output and the actual output from a set of labelled training data. The cost is then lowered by making slight adjustments to the weights and biases over and over throughout the training process, until the lowest possible value is obtained. The training process utilizes a “gradient”, which measures the rate at which the cost will change w.r.t. a change in a weight or a bias.

Early layers of a network are slowest to train, early layers are also RESPONSIBLE for early detection of features and building blocks. If we consider the face detection, early layers are important to figure out edges to correctly identify the face and then pass on the details to later layers where it’s features are captured and consolidated to be able to provide final output.

14.

What enables a deep neural net to recognize complex pattern? Explain with an example. Connect Side A to Side B in below table. (Multiple techniques in Side B can be used for a Side A problem, please tag all those)

Answer»

The key is that deep neural nets are able to break complex patterns down into a series of simpler patterns. For example: let’s say a task is to determine whether or not an image CONTAINED a human face. A deep neural net would first use edges to detect different parts of the face – the nose, lips, ears, eyes etc. and would then combine the results together to form the whole face. This IMPORTANT feature using simpler patterns as building blocks to detect “complex patterns” is what gives deep neural nets their strength.

There is one key downside to all this – deep neural nets take much longer to train. However with the advancement in technology, now there are high performance GPUs available that can finish training a complex net in a relatively QUICKER time compared to those using CPUs.

There are different categories to be able to handle both scenarios where labelled data exist and where there is no labelled data. Different TECHNIQUES / approaches can be used to hand such problems.

Below is correct mapping for the tabular data of Side A to Side B:

Side A
Side B
Unlabelled Data
Restricted Boltzmann MACHINE (RBM)Autoencoders
Text Processing
Recurrent Net (RNTN)
Unsupervised Learning
Restricted Boltzmann Machine (RBM) Autoencoders
Image Recognition
Deep Belief Nets (DBN) Convolutional Neural Nets (CNN)
Object Recognition
Recurrent Net (RNTN) Convolutional Neural Nets (CNN)
Speech Recognition
Recurrent Net (RNTN)
Classification
MLP/RELU, Deep Belief Nets (DBN)

*RNTN – Recursive Neural Tensor Network, *MLP – Multi Layer Perceptron, *RELU – Rectifier Linear Unit

15.

What is a neural network? Explain with an example and diagram.

Answer»

A neural network’s primary function is to receive a set of inputs, perform progressively complex computations, and then use the output to SOLVE the problem. Neural networks are used for lot of different applications, one example would be classification. There are lots of classifiers AVAILABLE today such as logistic regression, support vector machine, decision trees, random forest and so on and of COURSE neural networks.

For example, say we needed to predict if a person is healthy or sick. All you have are some input information such as height, weight, body temperature of each person, there is a need to classify / predict if a person is sick or healthy is a classification problem and it can be SOLVED using approaches such as neural networks. The classifier would receive the data about the patient, process it and give a CONFIDENCE score. A high score would indicate high confidence that patient is sick and a low score would suggest they are healthy. Score could be probability value of 0 to 1.

Neural network is highly structured and comes in layers. First layer is the input layer, last layer is the output layer and all layers in between are referred to as hidden layers. Hence a neural network can be viewed as the result of spinning classifiers together in a layered web.

16.

What is Deep Learning and how is it different from Machine Learning and Representative Learning?

Answer»

DEEP Learning is a BRANCH of machine learning based on a set of ALGORITHMS that attempt to model high level and hierarchical representation in data using deep graph with multiple processing layers, multiple linear and non-linear transformations.

In Machine Learning (ML), basic process flow is from “INPUT” to “hand designed features” to “mapping from features” to “output”. In Representation Learning (RL), basic process flow is from “Input” to “features” to “mapping from features” to “output”. In Deep Learning (DL), basic process flow is from “Input” to “ simple features” to “more layers of abstract  features” to “mapping from features” to “output”. Below table provides a quick REFERENCE of this understanding.

Topic / Area
Basic Process Flow
Machine Learning
Input