ML & DL
ML & DL
ML & DL
Ans:
Machine Learning:
“Machine Learning is defined as the study of computer programs
that leverage algorithms and statistical models to learn through
inference and patterns without being explicitly programed. Machine
Learning field has undergone significant developments in the last
decade.”
With machine learning algorithms, AI was able to develop beyond just
performing the tasks it was programmed to do. Before ML entered the
mainstream, AI programs were only used to automate low-level tasks in
business and enterprise settings.This included tasks like intelligent
automation or simple rule-based classification. This meant that AI
algorithms were restricted to only the domain of what they were
processed for. However, with machine learning, computers were able to
move past doing what they were programmed and began evolving with
each iteration.Machine learning is fundamentally set apart from artificial
intelligence, as it has the capability to evolve. Using various
programming techniques, machine learning algorithms are able to
process large amounts of data and extract useful information. In this
way, they can improve upon their previous iterations by learning from
the data they are provided.We cannot talk about machine learning
without speaking about big data, one of the most important aspects
of machine learning algorithms. Any type of AI is usually dependent on
the quality of its dataset for good results, as the field makes use of
statistical methods heavily.
Supervised Learning:
Supervised learning is one of the most basic types of machine learning.
In this type, the machine learning algorithm is trained on labeled data.
Even though the data needs to be labeled accurately for this method to
work, supervised learning is extremely powerful when used in the right
circumstances.
In supervised learning, the ML algorithm is given a small training
dataset to work with. This training dataset is a smaller part of the bigger
dataset and serves to give the algorithm a basic idea of the problem,
solution, and data points to be dealt with. The training dataset is also
very similar to the final dataset in its characteristics and provides the
algorithm with the labeled parameters required for the problem.
Unsupervised Learning:
Unsupervised machine learning holds the advantage of being able to
work with unlabeled data. This means that human labor is not required
to make the dataset machine-readable, allowing much larger datasets to
be worked on by the program.
In supervised learning, the labels allow the algorithm to find the exact
nature of the relationship between any two data points. However,
unsupervised learning does not have labels to work off of, resulting in
the creation of hidden structures. Relationships between data points are
perceived by the algorithm in an abstract manner, with no input required
from human beings.
Reinforcement learning:
directly takes inspiration from how human beings learn from data in
their lives. It features an algorithm that improves upon itself and learns
from new situations using a trial-and-error method. Favorable outputs
are encouraged or ‘reinforced’, and non-favorable outputs are
discouraged or ‘punished’.
Based on the psychological concept of conditioning, reinforcement
learning works by putting the algorithm in a work environment with an
interpreter and a reward system. In every iteration of the algorithm, the
output result is given to the interpreter, which decides whether the
outcome is favorable or not.
Applications of Machine Learning
→Machine learning algorithms are used in circumstances where the
solution is required to continue improving post-deployment.
→The dynamic nature of adaptable machine learning solutions is one of
the main selling points for its adoption by companies and organizations
across verticals.
➔Machine learning algorithms and solutions are versatile and can be
used as a substitute for medium-skilled human labor given the right
circumstances.
→For example, customer service executives in large B2C companies
have now been replaced by natural language processing machine
learning algorithms known as chatbots
→These chatbots can analyze customer queries and provide support for
human customer support executives or deal with the customers directly.
→Machine learning algorithms also help to improve user experience and
customization for online platforms
→Facebook, Netflix, Google, and Amazon all use recommendation
systems to prevent content glut and provide unique content to individual
users based on their likes and dislikes.
2. Explain about Over fitting the Training Data, and Under fitting
the Training Data?
Ans:
Overfitting and Underfitting in Machine Learning:
Overfitting and Underfitting are the two main problems that occur in
machine learning and degrade the performance of the machine learning
models.
The main goal of each machine learning model is to generalize well.
Here generalization defines the ability of an ML model to provide a
suitable output by adapting the given set of unknown input. It means
after providing training on the dataset, it can produce reliable and
accurate output. Hence, the underfitting and overfitting are the two terms
that need to be checked for the performance of the model and whether
the model is generalizing well or not.
Before understanding the overfitting and underfitting, let's understand
some basic term that will help to understand this topic well:
• Signal: It refers to the true underlying pattern of the data that helps
the machine learning model to learn from the data.
• Noise: Noise is unnecessary and irrelevant data that reduces the
performance of the model.
• Bias: Bias is a prediction error that is introduced in the model due
to oversimplifying the machine learning algorithms. Or it is the
difference between the predicted values and the actual values.
• Variance: If the machine learning model performs well with the
training dataset, but does not perform well with the test dataset,
then variance occurs.
Over fitting:
Overfitting occurs when our machine learning model tries to cover all
the data points or more than the required data points present in the given
dataset. Because of this, the model starts caching noise and inaccurate
values present in the dataset, and all these factors reduce the efficiency
and accuracy of the model. The overfitted model has low bias and high
variance.
The chances of occurrence of overfitting increase as much we provide
training to our model. It means the more we train our model, the more
chances of occurring the overfitted model.
Overfitting is the main problem that occurs in supervised learning.
Example: The concept of the overfitting can be understood by the below
graph of the linear regression output:
As we can see from the above graph, the model tries to cover all the data
points present in the scatter plot. It may look efficient, but in reality, it is
not so. Because the goal of the regression model to find the best fit line,
but here we have not got any best fit, so, it will generate the prediction
errors.
How to avoid the Overfitting in Model
Both overfitting and underfitting cause the degraded performance of the
machine learning model. But the main cause is overfitting, so there are
some ways by which we can reduce the occurrence of overfitting in our
model.
• Cross-Validation
• Training with more data
• Removing features
• Early stopping the training
• Regularization
• Ensembling
Underfitting:
Underfitting occurs when our machine learning model is not able to
capture the underlying trend of the data. To avoid the overfitting in the
model, the fed of training data can be stopped at an early stage, due to
which the model may not learn enough from the training data. As a
result, it may fail to find the best fit of the dominant trend in the data.
In the case of underfitting, the model is not able to learn enough from
the training data, and hence it reduces the accuracy and produces
unreliable predictions.
An underfitted model has high bias and low variance.
Example: We can understand the underfitting using below output of the
linear regression model:
As we can see from the above diagram, the model is unable to capture
the data points present in the plot.
How to avoid underfitting:
• By increasing the training time of the model.
• By increasing the number of features.
// Tensor Addition
const tensorNew = tensorA.add(tensorB);
// Tensor Subtraction
const tensorNew = tensorA.sub(tensorB);
// Tensor Multiplication
const tensorNew = tensorA.mul(tensorB);
// Result: [ 4, 8, 6, 8 ]
Tensor Division:
You can divide two tensors using tensorA.div(tensorB):
Example:
const tensorA = tf.tensor([[1, 2], [3, 4], [5, 6]]);
const tensorB = tf.tensor([[1,-1], [2,-2], [3,-3]]);
// Tensor Division
const tensorNew = tensorA.div(tensorB);
// Result: [ 2, 2, 3, 4 ]
Tensor Square:
You can square a tensor using tensor.square():
Example:
const tensorA = tf.tensor([1, 2, 3, 4]);
// Tensor Square
const tensorNew = tensorA.square();
// Result [ 1, 4, 9, 16 ]
Tensor Reshape:
The number of elements in a tensor is the product of the sizes in the
shape.
Since there can be different shapes with the same size, it is often useful
to reshape a tensor to other shapes with the same size.
You can reshape a tensor using tensor.reshape():
Example:
const tensorA = tf.tensor([[1, 2], [3, 4]]);
const tensorB = tensorA.reshape([4, 1]);
8. Error Analysis?
Ans:
Error analysis is the process to isolate, observe and diagnose erroneous
ML predictions thereby helping understand pockets of high and low
performance of the model. When it is said that “the model accuracy is
90%” it might not be uniform across subgroups of data and there might
be some input conditions which the model fails more. So, it is the next
step from aggregate metrics to a more in-depth review of model errors
for improvement.
An example might be that a dog detection image recognition model
might be doing better for dogs in an outdoor setting but not so good in
low-lit indoor settings. Of course, this might be due to skewed datasets
and error analysis helps identify if such cases impact model
performance. The below illustration provides a view of how moving
from aggregate to group-wise errors provides a better picture of model
performance.
9. Limits of Traditional Computer Programs?
Ans:
Traditional Programming:
Traditional programming is a manual process—meaning a person
(programmer) creates the program. But without anyone programming
the logic, one has to manually formulate or code rules.