Artificial Intelligence Interview Question Part 3

How to choose an algorithm for a problem?

To solve a problem, there can be multiple Machine Learning algorithms with different approaches and constraints. However, a generic approach can be applied to most of the problems and find a suitable algorithm. Below are the steps you need to consider while choosing an algorithm:

  • Categorize the Problem

The first is finding the algorithm, which is to categorize it based on the type of input you have and the output you want from it. If the data is labeled, it’s a problem for supervised learning. If the data is not labeled, then it’s an unsupervised learning problem. At last, if the problem aims to optimize a model, then it’s a reinforcement learning problem. 

Similarly, you can categorize a problem based on the outcome you want from the algorithm. If the output is expected to be numerical then it’s a regression problem. Is class is the output of a model, it’s a classification problem, and grouping of the input values can be categorized as the clustering problems. 

  • Understanding the Data

Data plays an important role in the process of selecting the right algorithm for your problem. This is because, some algorithms can process tons of data, while some works better with smaller samples. Analyzing and transforming your data will also help you to know the constraints and the challenges you t=want to overcome while solving the problem. 

  • Find the available Algorithms

Identify the available algorithms you can apply for solving the problem in a reasonable timeframe. Some of the factors that may affect your choice of the right algorithm include the accuracy of the algorithm, complexity, scalability interpretability, build & training time, space, and the time it takes to solve the problem.

  • Implement the Algorithm

After selecting the algorithm, you have to make an evaluation criteria by carefully selecting the testing values and subgroups of the datasets. Also, check the time taken by each algorithm to solve the problem. The algorithm that provides accurate results in the given time while acquiring less space, would be the best algorithm for your problem. 

What is an iterative deepening depth-first search algorithm?

The repetitive search processes of level 1 and level 2 happen in this search. The search processes continue until the solution is found. Nodes are generated until a single goal node is created. Stack of nodes is saved.

What is a uniform cost search algorithm?

The uniform cost search performs sorting in increasing the cost of the path to a node. It expands the least cost node. It is identical to BFS if each iteration has the same cost. It investigates ways in the expanding order of cost.

Artificial Intelligence Interview Question

Explain Alpha–Beta pruning?

Alpha–Beta pruning is a search algorithm that tries to reduce the number of nodes that are searched by the minimax algorithm in the search tree. It can be applied to ‘n’ depths and can prune the entire subtrees and leaves.

What is a partial-order planning?

A problem has to be solved in a sequential approach to attain the goal. The partial-order plan specifies all actions that need to be undertaken but specifies an order of the actions only when required.

What is the difference between inductive, deductive, and abductive Machine Learning?

Inductive Machine LearningDeductive Machine LearningAbductive Machine Learning
Learns from a set of instances to draw the conclusionDerives the conclusion and then improves it based on the previous decisionsIt is a Deep Learning technique where conclusions are derived based on various instances
Statistical Machine Learning such as KNN (K-nearest neighbor) or SVM (Support Vector Machine)Machine Learning algorithm using a decision treeDeep neural networks
A ⋀ B ⊢ A → B (Induction)A ⋀ (A → B) ⊢ B (Deduction)B ⋀ (A → B) ⊢ A (Abduction)

Advance Artificial Intelligence Interview Question

List the different algorithm techniques in Machine Learning.

Differentiation Based onSupervised LearningUnsupervised LearningReinforcement Learning
FeaturesThe training set has both predictors and predictions.The training set has only predictors.It can establish state-of-the-art results on any task.
AlgorithmsLinear and logistic regression, support vector machine, and Naive BayesK-means clustering algorithm and dimensionality reduction algorithmsQ-learning, state-action-reward-state-action (SARSA), and Deep Q Network (DQN)
UsesImage recognition, speech recognition, forecasting, etc.Preprocessing data, pre-training supervised learning algorithms, etc.Warehouses, inventory management, delivery management, power system, financial systems, etc.

Differentiate between parametric and non-parametric models.

Differentiation Based onParametric ModelNon-parametric Model
FeaturesA finite number of parameters to predict new dataUnbounded number of parameters
AlgorithmLogistic regression, linear discriminant analysis, perceptron, and Naïve BayesK-nearest neighbors, decision trees like CART and C4.5, and support vector machines
BenefitsSimple, fast, and less dataFlexibility, power, and performance
LimitationsConstrained, limited complexity, and poor fitMore data, slower, and overfitting

What is Naive Bayes?

Naive Bayes Machine Learning algorithm is a powerful algorithm for predictive modeling. It is a set of algorithms with a common principle based on Bayes Theorem. The fundamental Naive Bayes assumption is that each feature makes an independent and equal contribution to the outcome.

Artificial Intelligence Interview Question

What is a Backpropagation Algorithm?

Backpropagation is a Neural Network algorithm that is mainly used to process noisy data and detect unrecognized patterns for better clarification. It’s a full-state algorithm and has an iterative nature. As an ANN algorithm, Backpropagation has three layers, Input, hidden, and output layer. 

The input layers receive the input values and constraints from the user or the outside environment. After that, the data goes to the Hidden layer where the processing is done. At last, the processed data is transformed into some values or patterns that can be shared using the output layer.

Before processing the data, the following values should be there with the algorithm:

  • Dataset: The dataset which is going to be used for training a model.
  • Target Attributes: Output values that an algorithm should achieve after processing the data. 
  • Weights: In a neural network, weights are the parameters that transform input data within the hidden layer.
  • Biases: At each node, some values called bias are added to the sum calculated(except input nodes).

Backpropagation is simple ANN algorithm that follows a standard approach for training ML models. It doesn’t require high computational performance and is widely used in speed recognition, image processing, and optical character recognition(OCR).

How route weights are optimized to reduce the error in the model?

Weights in AI determine how much influence the input is going to have on the output. In neural networks, algorithms use weights to process the information and train the model. The output is expected to be the same as the target attributes.

However, the output may have some errors, which need to be rectified to produce the exact output. For example, in the Backpropagation algorithm when there is an error in the output, the algorithm will backpropagate to the hidden layer and reroute the weights to get an optimized output.

List the extraction techniques used for dimensionality reduction.

  • Independent component analysis
  • Principal component analysis
  • Kernel-based principal component analysis

Advance Artificial Intelligence Interview Question

Is KNN different from K-means Clustering?

KNNK-means Clustering
SupervisedUnsupervised
Classification algorithmsClustering algorithms
Minimal training modelExhaustive training model
Used in the classification and regression of the known dataUsed in population demographics, market segmentation, social media trends, anomaly detection, etc.

What is ensemble learning?

Ensemble learning is a computational technique in which classifiers or experts are strategically formed and combined. It is used to improve classification, prediction, function approximation, etc. of a model.

List the steps involved in Machine Learning.

  • Data collection
  • Data preparation
  • Choosing an appropriate model
  • Training the dataset
  • Evaluation
  • Parameter tuning
  • Predictions

Artificial Intelligence Interview Question

What is a hash table?

A hash table is a data structure that is used to produce an associative array which is mostly used for database indexing.

What is regularization in Machine Learning?

Regularization comes into the picture when a model is either overfit or underfit. It is basically used to minimize the error in a dataset. A new piece of information is fit into the dataset to avoid fitting issues.

What are the components of relational evaluation techniques?

  • Data acquisition
  • Ground truth acquisition
  • Cross validation technique
  • Query type
  • Scoring metric
  • Significance test

Advance Artificial Intelligence Interview Question

What is model accuracy and model performance?

Model accuracy, a subset of model performance, is based on the model performance of an algorithm. Whereas, model performance is based on the datasets we feed as inputs to the algorithm.

Define F1 score?

F1 score is the weighted average of precision and recall. It considers both false positive and false negative values into account. It is used to measure a model’s performance.

What is a recommendation system?

A recommendation system is an information filtering system that is used to predict user preference based on choice patterns followed by the user while browsing/using the system.

Artificial Intelligence Interview Question

What methods are used for reducing dimensionality?

Dimensionality reduction is the process of reducing the number of random variables. We can reduce dimensionality using techniques such as missing values ratio, low variance filter, high correlation filter, random forest, principal component analysis, etc.

List different methods for sequential supervised learning.

  • Sliding window methods
  • Recurrent sliding windows methods
  • Hidden Markov models
  • Maximum entropy Markov models
  • Conditional random fields
  • Graph transformer networks

What are the advantages of neural networks?

  • Require less formal statistical training
  • Have the ability to detect nonlinear relationships between variables
  • Detect all possible interactions between predictor variables
  • Availability of multiple training algorithms

Advance Artificial Intelligence Interview Question

What is Bias–Variance tradeoff?

Bias error is used to measure how much on an average the predicted values vary from the actual values. In case a high-bias error occurs, we have an under-performing model.

Variance is used to measure how the predictions made on the same observation differ from each other. A high-variance model will overfit the dataset and perform badly on any observation.

How to install Tensor Flow?

Tensor Flow Installation Guide:

CPU : pip install tensor flow-CPU

GPU : pip install tensor flow-gpu

What are the Tensor Flow objects?

Constants
Variables
Placeholder
Graph
Session

Artificial Intelligence Interview Question

What is a cost function?

A cost function is a scalar function that quantifies the error factor of the neural network. Lower the cost function better the neural network. For example, while classifying the image in the MNIST dataset, the input image is digit 2, but the neural network wrongly predicts it to be 3.

List different activation neurons or functions.

  1. Linear neuron
  2. Binary threshold neuron
  3. Stochastic binary neuron
  4. Sigmoid neuron
  5. Tanh function
  6. Rectified linear unit (RELU)

What is vanishing gradient?

As we add more and more hidden layers, backpropagation becomes less useful in passing information to the lower layers. In effect, as information is passed back, the gradients begin to vanish and become small relative to the weights of the network.

Advance Artificial Intelligence Interview Question

What are dropouts?

Dropout is a simple way to prevent a neural network from overfitting. It is the dropping out of some of the units in a neural network. It is similar to the natural reproduction process, where the nature produces offsprings by combining distinct genes (dropping out others) rather than strengthening the co-adapting of them.

Define LSTM.

Long short-term memory (LSTM) is explicitly designed to address the long-term dependency problem, by maintaining a state of what to remember and what to forget.

List the key components of LSTM.

  • Gates (forget, Memory, update, and Read)
  • Tanh(x) (values between −1 and 1)
  • Sigmoid(x) (values between 0 and 1)

Artificial Intelligence Interview Question

List the variants of RNN.

  • LSTM: Long Short-term Memory
  • GRU: Gated Recurrent Unit
  • End-to-end Network
  • Memory Network

What is an autoencoder? Name a few applications.

An autoencoder is basically used to learn a compressed form of the given data. A few applications of an autoencoder are given below:

  1. Data denoising
  2. Dimensionality reduction
  3. Image reconstruction
  4. Image colorization

What are the components of the generative adversarial network (GAN)? How do you deploy it?

Components of GAN:

  • Generator
  • Discriminator

Deployment Steps:

  • Train the model
  • Validate and finalize the model
  • Save the model
  • Load the saved model for the next prediction

Advance Artificial Intelligence Interview Question

What are the steps involved in the gradient descent algorithm?

Gradient descent is an optimization algorithm that is used to find the coefficients of parameters that are used to reduce the cost function to a minimum.

Step 1: Allocate weights (x,y) with random values and calculate the error (SSE)

Step 2: Calculate the gradient, i.e., the variation in SSE when the weights (x,y) are changed by a very small value. This helps us move the values of x and y in the direction in which SSE is minimized

Step 3: Adjust the weights with the gradients to move toward the optimal values where SSE is minimized

Step 4: Use new weights for prediction and calculating the new SSE

Step 5: Repeat Steps 2 and 3 until further adjustments to the weights do not significantly reduce the error

What do you understand by session in Tensor Flow?

Syntax: Class Session

It is a class for running TensorFlow operations. The environment is encapsulated in the session object wherein the operation objects are executed and Tensor objects are evaluated.

# Build a graph
x = tf.constant(2.0)
y = tf.constant(5.0)
z = x * y
# Launch the graph in a session
sess = tf.Session()
# Evaluate the tensor `z`
print(sess.run(z))

How to run Tensor Flow on Hadoop?

To use HDFS with Tensor Flow, we need to change the file path for reading and writing data to an HDFS path. For example:

filename_queue = tf.train.string_input_producer([
"hdfs://namenode:8020/path/to/file1.csv",
"hdfs://namenode:8020/path/to/file2.csv",
])

Artificial Intelligence Interview Question

What are intermediate tensors? Do sessions have lifetime?

The intermediate tensors are tensors that are neither inputs nor outputs of the Session. Run() call, but are in the path leading from the inputs to the outputs; they will be freed at or before the end of the call.

Sessions can own resources, few classes like tf.Variable, tf. Queue Base, and tf.Reader Base, and they use a significant amount of memory. These resources (and the associated memory) are released when the session is closed, by calling tf.Session.close.

What is the lifetime of a variable?

When we first run the tf.Variable.initializer operation for a variable in a session, it is started. It is destroyed when we run the tf.Session.close operation.

Is it possible to solve logical inference in propositional logic?

Yes, logical inference can easily be solved in propositional logic by making use of three concepts:

  • Logical equivalence
  • Process satisfaction
  • Validation checking

Advance Artificial Intelligence Interview Question

How does face verification work?

Face verification is used by a lot of popular firms these days. Facebook is famous for the usage of DeepFace for its face verification needs.

There are four main things you must consider when understanding how face verification works:

  • Input: Scanning an image or a group of images
  • Process:
    • Detection of facial features
    • Feature comparison and alignment
    • Key pattern representation
    • Final image classification
  • Output: Face representation, which is a result of a multilayer neural network
  • Training data: Involves the usage of thousands of millions of images

The implementation of face verification in Python requires special libraries such as glob, NumPy, OpenCV(cv2), and face_recognisation. Among them, OpenCV is one of the most widely used libraries for computer vision and image processing. 

OpenCV is a beginner-friendly, cross-platform python library that is mainly used for real-time image and video processing applications. With OpenCV, you can create applications used for object detection, facial recognition, and object tracking. It can also be used to extract the facial features and identify unique patterns for face verification.

What are some of the algorithms used for hyperparameter optimization?

There are many algorithms that are used for hyperparameter optimization, and following are the three main ones that are widely used:

  • Bayesian optimization
  • Grid search
  • Random search

How is overfitting fixed?

Overfitting can be prevented by using the below-mentioned methods:

  • Early stopping
  • Ensemble models
  • Cross-validation
  • Feature removal
  • Regularization

Artificial Intelligence Interview Question

How is overfitting avoided in neural networks?

Overfitting is avoided in neural nets by making use of a regularization technique called ‘dropout.’

By making use of the concept of dropouts, random neurons are dropped when the neural network is being trained to use the model doesn’t overfit. If the dropout value is too low, it will have a minimal effect. If it is too high, the model will have difficulty in learning.

Artificial Intelligence Part 1Artificial Intelligence Part 2
Back to top