0% found this document useful (0 votes)
18 views40 pages

ML Internship

The document is a virtual internship report by Neelam Sasi Priya, detailing her experience as an AI & ML Developer at Chip Electronics from May to July 2023. It covers the fundamentals of machine learning, its history, life cycle, and applications, emphasizing the importance of data in training algorithms. The report also includes acknowledgments and a certification of completion for her Bachelor of Technology in Computer Science and Engineering.

Uploaded by

sasipriyaneelam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views40 pages

ML Internship

The document is a virtual internship report by Neelam Sasi Priya, detailing her experience as an AI & ML Developer at Chip Electronics from May to July 2023. It covers the fundamentals of machine learning, its history, life cycle, and applications, emphasizing the importance of data in training algorithms. The report also includes acknowledgments and a certification of completion for her Bachelor of Technology in Computer Science and Engineering.

Uploaded by

sasipriyaneelam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

VIRTUAL INTERNSHIP REPORT

ON

AI & ML DEVELOPER (MACHINE LEARNING)


A Report submitted in partial fulfilment oft the requirements for the Award of Degree of

BACHELOR OF TECHNOLOGY
IN

COMPUTER SCIENCE AND ENGINEERING


BY
NEELAM SASI PRIYA (20B81A05C0)
Under the Esteemed Supervision of
Mr. UPENDRA
CHIP ELECTRONICS, VIJAYAWADA
(Duration: 15th May 2023 to 8th July 2023)

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


SIR C R REDDY COLLEGE OF ENGINEERING
Approved by AICTE, permanently affiliated to JNTU, Kakinada
ELURU, ANDHRA PRADESH
2020-2024

1
SIR C R REDDY COLLEGE OF ENGINEERING

CERTIFICATE

This is to certify that this Virtual Internship report entitled “AI & ML DEVEOPER
(MACHINE LEARNING)” submitted by NEELAM SASI PRIYA (20B81A05C0) in
partial fulfilment for the award of degree of BACHELOR OFTECHNOLOGY in
COMPUTER SCIENCE AND ENGINEERING, at SIR C R REDDYCOLLEGE OF
ENGINEERING, ELURU affiliated to Jawaharlal Nehru Technological University,
Kakinada.

Internship Coordinator Internship Guide Head of the Department


Mr.B. Madhava Rao Mr.V.PRANAV, M.Tech DR.A. YesuBabu, M.Tech,Phd
Assistant Professor, CSE Assistant Professor, CSE Professor & Head, CSE

EXTERNAL EXAMINER

2
3
ACKNOWLEDGEMENT

First, I would like to thank Mr. Upendar, Chip Electronics, Vijayawada for giving
me this Opportunity to do an internship within the organization. I also would like all the
people that worked along with me Chip Electronics, Vijayawada with their patience
and openness they created an enjoyable working environment.

It is indeed with a great sense of pleasure and immense sense of gratitude that I
acknowledge the help of these individuals.

I am highly indebted to Principal Dr. K. VENKATESWARA RAO, for the facilities


provided to accomplish this internship.

I would like to thank my Head of the Department Dr. A. YESU BABU, for his
constructive criticism throughout my internship.

I would like to thank, Mr. V. PRANAV Internship coordinator Department of CSE for
his support and advices to get and complete internship in above Said organization.

I am extremely grateful to my department staff members and friends who helped me


in successful completion of this internship.

NEELAM SASI PRIYA

(20B81A05C0)

4
ABSTRACT
Machine learning is a branch of artificial intelligence (AI) and computer science
which focuses on the use of data and algorithms to imitate the way that
humans learn, gradually improving its accuracy.

Over the last couple of decades, the technological advances in storage and
processing power have enabled some innovative products based on machine
learning, such as Netflix’s recommendation engine and self-driving cars.

Machine learning is an important component of the growing field of data


science. Through the use of statistical methods, algorithms are trained to make
classifications or predictions, and to uncover key insights in data mining
projects. These insights subsequently drive decision making within applications
and businesses, ideally impacting key growth metrics. As big data continues to
expand and grow, the market demand for data scientists will increase. They
will be required to help identify the most relevant business questions and the
data to answer them. Machine learning algorithms are typically created using
frameworks that accelerate solution development, such as TensorFlow and
PyTorch.

ORGANISATION INFORMATION

CHIP ELECTRONICS is an internship online and offline training platform,


based in Vijayawada, Andhra Pradesh, India. Founded by UPENDRA, this
institute helps students to find internships with the organisation of India. The
platform, which was founded in 2023, started out as a WordPress blog that
aggregated internships across India and articles of education, technology and
skill gap launched its online trainings in 2023. In 2023, this organisation
associated with AP LMS portal.

5
LEARNING OBJECTIVES/INTERNSHIP
OBJECTIVES

➢ Internships are generally thought to be reserved for college students looking to


gain experience in a particular field. However, a wide array of people can benefit
from Training Internships in order to receive real world experience and develop
their skills.

➢ An objective for this position should emphasize the skills you already possess in
the area and your interest in learning more.

➢ Internships are utilized in a number of different fields, including architecture,


engineering, healthcare, economics, advertising and many more.

➢ Some internships are used to individuals to perform scientific research while


others are specifically designed to allow people to gain first-hand experience
working.

➢ Utilizing internships is a great way to build your resume and develop skills that
emphasized in your resume for future jobs.

➢ Utilizing
➢ When you are applying for a Training Internship, make sure to highlight any
special skills or talents that can make you stand apart from the rest of the
applicants so that you have an improved chance of landing the position.

6
INDEX

S.NO CONTENTS PAGE.NO

1. Introduction …………………………………………………………………………………8
2. History and Evaluation of Machine Learning…………………………………. 9
3. Life Cycle of Machine Learning……………………………………………………. 10
4. Classification of Machine Learning………………………………………………. 12
5. Supervised Machine Learning………………………………………………………15
Types of Supervised Machine Learning Algorithms……………………….16
Types of Classification………………………………………………………………….19
Types of Regression…………………………………………………………………….24
6. Unsupervised Machine Learning………………………………………………….31
Clustering In Machine Learning……………………………………………………32
Types of Clustering Methods……………………………………………………….33
Types of Clustering Algorithms…………………………………………………….35
Principal Component Analysis…………………………………………………….37
7. Applications of Machine Learning……………………………………………….38
8. Conclusion………………………………………………………………………………….39

7
INTRODUCTION
Machine learning (ML) is a branch of artificial intelligence (AI) that enables computers to
“self-learn” from training data and improve over time, without being explicitly programmed.
Machine learning algorithms are able to detect patterns in data and learn from them, in
order to make their own predictions. In short, machine learning algorithms and models learn
through experience.
In traditional programming, a computer engineer writes a series of directions that instruct a
computer how to transform input data into a desired output. Instructions are mostly based
on an IF-THEN structure: when certain conditions are met, the program executes a specific
action.
Machine learning, on the other hand, is an automated process that enables machines to
solve problems with little or no human input, and take actions based on past observations.
While artificial intelligence and machine learning are often used interchangeably, they are
two different concepts. AI is the broader concept – machines making decisions, learning new
skills, and solving problems in a similar way to humans – whereas machine learning is a
subset of AI that enables intelligent systems to autonomously learn new things from data.
Instead of programming machine learning algorithms to perform tasks, you can feed them
examples of labelled data (known as training data), which helps them make calculations,
process data, and identify patterns automatically.
Put simply, Google’s Chief Decision Scientist describes machine learning as a fancy labelling
machine. After teaching machines to label things like apples and pears, by showing them
examples of fruit, eventually they will start labelling apples and pears without any help –
provided they have learned from appropriate and accurate training examples.
Machine learning can be put to work on massive amounts of data and can perform much
more accurately than humans.

8
HISTORY AND EVOLUTION OF MACHINE
LEARNING
Before some years (about 40-50 years), machine learning was science fiction, but today it is the part
of our daily life. Machine learning is making our day today life easy from self-driving cars to Amazon
virtual assistant "Alexa". However, the idea behind machine learning is so old and has a long history.
Below some milestones are given which have occurred in the history of machine learning: The early
history of Machine Learning (Pre-1940): 1834: In 1834, Charles Babbage, the father of the computer,
conceived a device that could be programmed with punch cards. However, the machine was never
built, but all modern computers rely on its logical structure. 1936: In 1936, Alan Turing gave a theory
that how a machine can determine and execute a set of instructions. The era of stored program
computers: 1940: In 1940, the first manually operated computer, "ENIAC" was invented, which was
the first electronic general-purpose computer. After that stored program computer such as EDSAC in
1949 and EDVAC in 1951 were invented. 1943: In 1943, a human neural network was modelled with
an electrical circuit. In 1950, the scientists started applying their idea to work and analysed how
human neurons might work. Computer machinery and intelligence: 1950: In 1950, Alan Turing
published a seminal paper, "Computer Machinery and Intelligence," on the topic of artificial
intelligence. In his paper, he asked, "Can machines think?"

Machine intelligence in Games: 1952: Arthur Samuel, who was the pioneer of machine
learning, created a program that helped an IBM computer to play a checkers game. It performed
better more it played. 1959: In 1959, the term "Machine Learning" was first coined by Arthur Samuel.

The first "AI" winter: The duration of 1974 to 1980 was the tough time for AI and ML
researchers, and this duration was called as AI winter. 6/7 In this duration, failure of machine
translation occurred, and people had reduced their interest from AI, which led to reduced funding by
the government to the researches.

Machine Learning from theory to reality 1959: In 1959, the first neural network was
applied to a real-world problem to remove echoes over phone lines using an adaptive filter. 1985: In
1985, Terry Sejnowski and Charles Rosenberg invented a neural network , Which was able to teach
itself how to correctly pronounce 20,000 words in one week. 1997: The IBM's Deep blue intelligent
computer won the chess game against the chess expert Garry Kasparov, and it became the first
computer which had beaten a human chess expert. Machine Learning at 21 Century.

2006: In the year 2006, computer scientist Geoffrey Hinton has given a new name to neural net
research as "deep learning," and nowadays, it has become one of the most trending technologies.

2012: In 2012, Google created a deep neural network which learned to recognize the image of
humans and cats in YouTube videos.

2014: In 2014, the Chabot "Eugen Goostman" cleared the Turing Test. It was the first Chabot who
convinced the 33% of human judges that it was not a machine.

9
2014: Deep Face was a deep neural network created by Facebook, and they claimed that it could
recognize a person with the same precision as a human can do.

2016: AlphaGo beat the world's number second player Lee sedol at Go game. In 2017 it beat the
number one player of this game Ke Jie.

2017: In 2017, the Alphabet's Jigsaw team built an intelligent system that was able to learn the
online trolling. It used to read millions of comments of different websites to learn to stop online
trolling.

Machine Learning at present: Now machine learning has got a great advancement in its
research, and it is present everywhere around us, such as self-driving cars, Amazon Alexa, Catboats,
recommender system, and many more. It includes Supervised, unsupervised, and reinforcement
learning with clustering, classification, decision tree, SVM algorithms, etc. Modern machine learning
models can be used for making various predictions, including weather prediction, disease prediction,
stock market analysis, etc.

Life cycle of Machine Learning


Machine learning Life cycle Machine learning has given the computer systems the abilities to
automatically learn without being explicitly programmed. But how does a machine learning system
work? So, it can be described using the life cycle of machine learning. Machine learning life cycle is a
cyclic process to build an efficient machine learning project.

The main purpose of the life cycle is to find a solution to the problem or project. Machine learning
life cycle involves seven major steps, which are given below:

• Gathering Data
• Data preparation
• Data Wrangling
• Analyse Data
• Train the model
• Test the model
• Deployment

10
1. Gathering Data: Data Gathering is the first step of the machine learning life cycle. The goal of this
step is to identify and obtain all data-related problems. In this step, we need to identify the different
data sources, as data can be collected from various sources such as files, database, internet, or
mobile devices. It is one of the most important steps of the life cycle. The quantity and quality of the
collected data will determine the efficiency of the output. The more will be the data, the more
accurate will be the prediction. This step includes the below tasks: Identify various data sources
Collect data Integrate the data obtained from different sources By performing the above task, we get
a coherent set of data, also called as a dataset. It will be used in further steps.

2. Data preparation: After collecting the data, we need to prepare it for further steps. Data
preparation is a step where we put our data into a suitable place and prepare it to use in our
machine learning training. In this step, first, we put all data together, and then randomize the
ordering of data.

This step can be further divided into two processes:

Data exploration: It is used to understand the nature of data that we have to work with. We need
to understand the characteristics, format, and quality of data. A better understanding of data leads
to an effective outcome. In this, we find Correlations, general trends, and outliers.

Data pre-processing: Now the next step is preprocessing of data for its analysis.

3. Data Wrangling: Data wrangling is the process of cleaning and converting raw data into a useable
format. It is the process of cleaning the data, selecting the variable to use, and transforming the data
in a proper format to make it more suitable for analysis in the next step. It is one of the most
important steps of the complete process. Cleaning of data is required to address the quality issues. It
is not necessary that data we have collected is always of our use as some of the data may not be
useful. In real-world applications, collected data may have various issues, including:

• Missing Values
• Duplicate data
• Invalid data
• Noise

4. Data Analysis: Now the cleaned and prepared data is passed on to the analysis step. This step
involves:

• Selection of analytical techniques


• Building models
• Review the result

The aim of this step is to build a machine learning model to analyse the data using various analytical
techniques and review the outcome. It starts with the determination of the type of the problems,
where we select the machine learning techniques such as Classification, Regression, Cluster analysis,
Association, etc. then build the model using prepared data, and evaluate the model. Hence, in this
step, we take the data and use machine learning algorithms to build the model.

5. Train Model : Now the next step is to train the model, in this step we train our model to improve
its performance for better outcome of the problem. We use datasets to train the model using various

11
machine learning algorithms. Training a model is required so that it can understand the various
patterns, rules, and, features.

6. Test Model : Once our machine learning model has been trained on a given dataset, then we test
the model. In this step, we check for the accuracy of our model by providing a test dataset to it.
Testing the model determines the percentage accuracy of the model as per the requirement of
project or problem.

7. Deployment: The last step of machine learning life cycle is deployment, where we deploy the
model in the real-world system. If the above-prepared model is producing an accurate result as per
our requirement with acceptable speed, then we deploy the model in the real system. But before
deploying the project, we will check whether it is improving its performance using available data or
not. The deployment phase is similar to making the final report for a project.

CLASSIFICATION OF MACHINE LEARNING


Machine learning is a subset of AI, which enables the machine to automatically learn from data,
improve performance from past experiences, and make predictions. Machine learning contains a set
of algorithms that work on a huge amount of data. Data is fed to these algorithms to train them, and
on the basis of training, they build the model & perform a specific task

These ML algorithms help to solve different business problems like Regression, Classification,
Forecasting, Clustering, and Associations, etc. Based on the methods and way of learning, machine
learning is divided into mainly four types, which are:

1. Supervised Machine Learning

2. Unsupervised Machine Learning

3. Semi-Supervised Machine Learning

4. Reinforcement Learning

12
1.Supervised Machine Learning: As its name suggests, Supervised machine learning is based on
supervision. It means in the supervised learning technique, we train the machines using the
"labelled" dataset, and based on the training, the machine predicts the output. Here, the labelled
data specifies that some of the inputs are already mapped to the output. More preciously, we can
say; first, we train the machine with the input and corresponding output, and then we ask the
machine to predict the output using the test dataset.

The main goal of the supervised learning technique is to map the input variable(x) with the output
variable(y). Some real-world applications of supervised learning are Risk Assessment, Fraud Detection,
Spam filtering, etc.

Categories of Supervised Machine Learning Supervised machine learning can be classified into two
types of problems, which are given below:

• Classification
• Regression

2.Unsupervised Machine Learning: Unsupervised learning is different from the Supervised


learning technique; as its name suggests, there is no need for supervision. It means, in unsupervised
machine learning, the machine is trained using the unlabelled dataset, and the machine predicts the
output without any supervision.

In unsupervised learning, the models are trained with the data that is neither classified nor labelled,
and the model acts on that data without any supervision.

The main aim of the unsupervised learning algorithm is to group or categories the unsorted dataset
according to the similarities, patterns, and differences. Machines are instructed to find the hidden
patterns from the input dataset.

Categories of Unsupervised Machine Learning: Unsupervised Learning can be further classified


into two types, which are given below:

• Clustering
• Association

3.Semi-Supervised Learning: Semi-Supervised learning is a type of Machine Learning algorithm


that lies between Supervised and Unsupervised machine learning. It represents the intermediate
ground between Supervised (With Labelled training data) and Unsupervised learning (with no labelled
training data) algorithms and uses the combination of labelled and unlabelled datasets during the
training period.

4. Reinforcement Learning: Reinforcement learning works on a feedback-based process, in which


an AI agent (A software component) automatically explore its surrounding by hitting & trail, taking
action, learning from experiences, and improving its performance. Agent gets rewarded for each good
action and get punished for each bad action; hence the goal of reinforcement learning agent is to
maximize the rewards. In reinforcement learning, there is no labelled data like supervised learning,
and agents learn from their experiences only.

13
Categories of Reinforcement Learning: Reinforcement learning is categorized mainly into two
types of methods/algorithms:

Positive Reinforcement Learning: Positive reinforcement learning specifies increasing the tendency
that the required behaviour would occur again by adding something. It enhances the strength of the
behaviour of the agent and positively impacts it.

Negative Reinforcement Learning: Negative reinforcement learning works exactly opposite to the
positive RL. It increases the tendency that the specific behaviour would occur again by avoiding the
negative condition. Real-world Use cases of Reinforcement Learning Video Games: RL algorithms are
much popular in gaming applications. It is used to gain superhuman performance. Some popular
games that use RL algorithms are AlphaGO and AlphaGO Zero.

Resource Management: The "Resource Management with Deep Reinforcement Learning" paper
showed that how to use RL in computer to automatically learn and schedule resources to wait for
different jobs in order to minimize average job slowdown.

Robotics: RL is widely being used in Robotics applications. Robots are used in the industrial and
manufacturing area, and these robots are made more powerful with reinforcement learning. There
are different industries that have their vision of building intelligent robots using AI and Machine
learning technology.

Text Mining: Text-mining, one of the great applications of NLP, is now being implemented with the
help of Reinforcement Learning by Salesforce company.

14
SUPERVISED MACHINE LEARNING

How Supervised Learning Works?

In supervised learning, models are trained using labelled dataset, where the model learns about
each type of data. Once the training process is completed, the model is tested on the basis of
test data (a subset of the training set), and then it predicts the output.

The working of Supervised learning can be easily understood by the below example and diagram:

Steps Involved in Supervised Learning:

• First Determine the type of training dataset


• Collect/Gather the labelled training data.
• Split the training dataset into training dataset, test dataset, and validation dataset.
• Determine the input features of the training dataset, which should have enough knowledge
so that the model can accurately predict the output.
• Determine the suitable algorithm for the model, such as support vector machine, decision
tree, etc. Execute the algorithm on the training dataset. Sometimes we need validation sets
as the control parameters, which are the subset of training datasets.
• Evaluate the accuracy of the model by providing the test set. If the model predicts the correct
output, which means our model is accurate.

15
Types of supervised Machine learning Algorithms: Supervised learning can be further divided
into two types of problems

Regression: Regression algorithms are used if there is a relationship between the input variable and
the output variable. It is used for the prediction of continuous variables, such as Weather forecasting,
Market Trends, etc. Below are some popular Regression algorithms which come under supervised
learning:

• Linear Regression
• Regression Trees
• Non-Linear Regression
• Bayesian Linear Regression
• Polynomial Regression

Classification: Classification algorithms are used when the output variable is categorical, which
means there are two classes such as Yes-No, Male-Female, True-false, etc. Spam Filtering,

• Random Forest
• Decision Trees
• Logistic Regression
• Support vector Machines

Advantages of Supervised learning:

With the help of supervised learning, the model can predict the output on the basis of prior
experiences.

In supervised learning, we can have an exact idea about the classes of objects. Supervised learning
model helps us to solve various real-world problems such as fraud detection, spam filtering, etc.

Disadvantages of supervised learning:

Supervised learning models are not suitable for handling the complex tasks.

16
Supervised learning cannot predict the correct output if the test data is different from the training
dataset. Training required lots of computation times. In supervised learning, we need enough
knowledge about the classes of object.

Classification Algorithm in Machine Learning


The Classification algorithm is a Supervised Learning technique that is used to identify the category of
new observations on the basis of training data. In Classification, a program learns from the given
dataset or observations and then classifies new observation into a number of classes or groups. Such
as, Yes or No, 0 or 1, Spam or Not Spam, cat or dog, etc. Classes can be called as targets/labels or
categories.

In classification algorithm, a discrete output function(y) is mapped to input variable(x).

The best example of an ML classification algorithm is Email Spam Detector.

The main goal of the Classification algorithm is to identify the category of a given dataset, and these
algorithms are mainly used to predict the output for the categorical data.

The algorithm which implements the classification on a dataset is known as a classifier. There are two
types of Classifications:

Binary Classifier: If the classification problem has only two possible outcomes, then it is called as
Binary Classifier.

Examples: YES or NO, MALE or FEMALE, SPAM or NOT SPAM, CAT or DOG, etc.

Multi-class Classifier: If a classification problem has more than two outcomes, then it is called as
Multi-class Classifier.

Example: Classifications of types of crops, Classification of types of music.

Learners in Classification Problems: In the classification problems, there are two types of learners:
1. Lazy Learners: Lazy Learner firstly stores the training dataset and wait until it receives the test
dataset. In Lazy learner case, classification is done on the basis of the most related data stored in the
training dataset. It takes less time in training but more time for predictions.

Example: K-NN algorithm, Case-based reasoning

2.Eager Learners: Eager Learners develop a classification model based on a training dataset before
receiving a test dataset. Opposite to Lazy learners, Eager Learner takes more time in learning, and less
time in prediction.

Example: Decision Trees, Naïve Bayes, ANN.

17
Types of Machine Learning Classification
Algorithms
Classification Algorithms can be further divided into the Mainly two category:

• Linear Models

Logistic Regression

Support Vector Machines

• Non-linear Models

K-Nearest Neighbours

Kernel SVM

Naïve Bayes

Random Forest Classification

Decision Tree Classification

Evaluating a Classification Model


Once our model is completed, it is necessary to evaluate its performance; either it is a Classification or
Regression model. So for evaluating a Classification model, we have the following ways:
1. Log Loss or Cross-Entropy Loss:
• It is used for evaluating the performance of a classifier, whose output is a probability value
between the 0 and 1.
• For a good binary Classification model, the value of log loss should be near to 0.
• The value of log loss increases if the predicted value deviates from the actual value.
• The lower log loss represents the higher accuracy of the model.
• For Binary classification, cross-entropy can be calculated as:
Where y= Actual output, p= predicted output.

2. Confusion Matrix: The confusion matrix provides us a matrix/table as output and describes the
performance of the model.
It is also known as the error matrix.
The matrix consists of predictions result in a summarized form, which has a total number of
correct predictions and incorrect predictions. The matrix looks like as below table:

18
3. AUC-ROC curve: ROC curve stands for Receiver Operating Characteristics Curve and AUC stands
for Area Under the Curve. It is a graph that shows the performance of the classification model at
different thresholds. To visualize the performance of the multi-class classification model, we use
the AUC-ROC Curve. The ROC curve is plotted with TPR and FPR, where TPR (True Positive Rate)
on Y-axis and FPR (False Positive Rate) on X-axis.

TYPES OF CLASSIFICATION
• Binary Classification
• Multi -class Classification

Binary Classification

It is a process or task of classification, in which a given data is being classified into two classes. It’s
basically a kind of prediction about which of two groups the thing belongs to.

Binary classification uses some algorithms to do the task, some of the most common algorithms used
by binary classification are:

1. PRECISION: Precision in binary classification (Yes/No) refers to a model's ability to correctly


interpret positive observations. In other words, how often does a positive value forecast turn out to
be correct? We may manipulate this metric by only returning positive for the single observation in
which we have the most confidence.

2. RECALL: The recall is also known as sensitivity. In binary classification (Yes/No) recall is used to
measure how “sensitive” the classifier is to detecting positive cases. To put it another way, how many
real findings did we “catch” in our sample? We may manipulate this metric by classifying both results
as positive.

3. F1 SCORE: The F1 score can be thought of as a weighted average of precision and recall, with the
best value being 1 and the worst being 0. Precision and recall also make an equal contribution to the
F1 ranking.

19
Multiclass Classification

Multi-class classification is the task of classifying elements into different classes. Unlike binary, it
doesn’t restrict itself to any number of classes.

Examples of multi-class classification are

• classification of news in different categories,


• classifying books according to the subject,
• classifying students according to their streams etc.

K-Nearest Neighbour (KNN) Algorithm for Machine


Learning
• K-Nearest Neighbour is one of the simplest Machine Learning algorithms based on Supervised
Learning technique.
• K-NN algorithm assumes the similarity between the new case/data and available cases and
put the new case into the category that is most similar to the available categories.
• K-NN algorithm stores all the available data and classifies a new data point based on the
similarity. This means when new data appears then it can be easily classified into a well suite
category by using K- NN algorithm. K-NN algorithm can be used for Regression as well as for
Classification but mostly it is used for the Classification problems.
• K-NN is a non-parametric algorithm, which means it does not make any assumption on
underlying data. It is also called a lazy learner algorithm because it does not learn from the
training set immediately instead it stores the dataset and at the time of classification, it
performs an action on the dataset.
• KNN algorithm at the training phase just stores the dataset and when it gets new data, then
it classifies that data into a category that is much similar to the new data.

20
How does K-NN work?

The K-NN working can be explained on the basis of the below algorithm:

Step-1: Select the number K of the neighbours

Step-2: Calculate the Euclidean distance of K number of neighbours

Step-3: Take the K nearest neighbours as per the calculated Euclidean distance.

Step-4: Among these k neighbours, count the number of the data points in each category.

Step-5: Assign the new data points to that category for which the number of the neighbor is
maximum.

Step-6: Our model is ready.

Advantages of KNN Algorithm: It is simple to implement. It is robust to the noisy training data It
can be more effective if the training data is large.

Disadvantages of KNN Algorithm: Always needs to determine the value of K which may be
complex some time. The computation cost is high because of calculating the distance between the
data points for all the training samples.

Python implementation of the KNN Algorithm


Problem for K-NN Algorithm: There is a Car manufacturer company that has manufactured a new
SUV car. The company wants to give the ads to the users who are interested in buying that SUV. So
for this problem, we have a dataset that contains multiple user's information through the social
network. The dataset contains lots of information but the Estimated Salary and Age we will consider
for the independent variable and the Purchased variable is for the dependent variable.
Steps to implement the K-NN algorithm:

• Data Pre-processing step


• Fitting the K-NN algorithm to the Training set
• Predicting the test result
• Test accuracy of the result (Creation of Confusion matrix)
• Visualizing the test set result.

The dataset is below:

21
Decision Tree Algorithm

Decision trees are a popular machine learning algorithm that can be used for both regression and
classification tasks.

A decision tree is a hierarchical model used in decision support that depicts decisions and their
potential outcomes, incorporating chance events, resource expenses, and utility. This algorithmic
model utilizes conditional control statements and is non-parametric, supervised learning, useful for
both classification and regression tasks. The tree structure is comprised of a root node, branches,
internal nodes, and leaf nodes, forming a hierarchical, tree-like structure.

It is a tool that has applications spanning several different areas. Decision trees can be used for
classification as well as regression problems. The name itself suggests that it uses a flowchart like a
tree structure to show the predictions that result from a series of feature-based splits. It starts with a
root node and ends with a decision made by leaves

Before learning more about decision trees let’s get familiar with some of the terminologies:

Root Nodes – It is the node present at the beginning of a decision tree from this node the
population starts dividing according to various features.

Decision Nodes – the nodes we get after splitting the root nodes are called Decision Node.

22
Leaf Nodes – the nodes where further splitting is not possible are called leaf nodes or terminal
nodes.

Sub-tree – just like a small portion of a graph is called subgraph similarly a sub-section of this
decision tree is called subtree.

Pruning – is nothing but cutting down some nodes to stop overfitting.

Entropy:
Entropy is nothing but the uncertainty in our dataset or measure of disorder.

In a decision tree, the output is mostly “yes” or “no”

E=−(plog2p+plog2pp+plog2p)

The formula for Entropy is shown below:

Here p is the probability of positive class

p is the probability of negative class

S is the subset of the training example

Information Gain
Information gain measures the reduction of uncertainty given some feature and it is also a deciding
factor for which attribute should be selected as a decision node or root node.

Information Gain = E(Y)-E(Y/X)


It is just entropy of the full dataset – entropy of the dataset given some feature.

Pruning
It is another method that can help us avoid overfitting. It helps in improving the performance of the
tree by cutting the nodes or sub-nodes which are not significant. It removes the branches which have
very low importance.

There are mainly 2 ways for pruning:

Pre-pruning – we can stop growing the tree earlier, which means we can prune/remove/cut a node
if it has low importance while growing the tree.

Post-pruning – once our tree is built to its depth, we can start pruning the nodes based on their
significance.

23
TYPES OF REGRESSION

Linear Regression in Machine Learning


Linear regression is one of the easiest and most popular Machine Learning algorithms. It is a
statistical method that is used for predictive analysis. Linear regression makes predictions for
continuous/real or numeric variables such as sales, salary, age, product price, etc.

Linear regression algorithm shows a linear relationship between a dependent (y) and one or more
independent (y) variables, hence called as linear regression. Since linear regression shows the linear
relationship, which means it finds how the value of the dependent variable is changing according to
the value of the independent variable.

The linear regression model provides a sloped straight line representing the relationship between
the variables.

Mathematically, we can represent a linear regression as:

y= a +a x+ ε

Here, Y= Dependent Variable (Target Variable)

24
X= Independent Variable (predictor Variable)

a0= intercept of the line (Gives an additional degree of freedom)

a1 = Linear regression coefficient (scale factor to each input value).

ε = random error

The values for x and y variables are training datasets for Linear Regression model representation.

Types of Linear Regression:

Linear regression can be further divided into two types of the algorithm:

Simple Linear Regression: If a single independent variable is used to predict the value of a
numerical dependent variable, then such a Linear Regression algorithm is called Simple Linear
Regression.

Multiple Linear regression: If more than one independent variable is used to predict the value of a
numerical dependent variable, then such a Linear Regression algorithm is called Multiple Linear
Regression.

Polynomial Regression
Polynomial Regression is a type of regression which models the non-linear dataset using a linear
model. It is similar to multiple linear regression, but it fits a non-linear curve between the value of x
and corresponding conditional values of y. Suppose there is a dataset which consists of datapoints
which are present in a non-linear fashion, so for such case, linear regression will not best fit to those
datapoints. To cover such datapoints, we need Polynomial regression. In Polynomial regression, the
original features are transformed into polynomial features of given degree and then model using a
linear model. Which means the datapoints are best fitted using a polynomial line.

Polynomial regression equation Y= b +b x+ b x + b x +.....+ b x .

Here Y is the predicted/target output, b , b ,... b are the regression coefficients. x is our
independent/input variable.

25
Support Vector Regression in Machine Learning
Support Vector Machine is a supervised learning algorithm which can be used for regression as well
as classification problems. So if we use it for regression problems, then it is termed as Support Vector
Regression.

Support Vector Regression is a regression algorithm which works for continuous variables. Below are
some keywords which are used in Support Vector Regression:

• Kernel: It is a function used to map a lower-dimensional data into higher dimensional data.
• Hyperplane: In general SVM, it is a separation line between two classes, but in SVR, it is a
line which helps to predict the continuous variables and cover most of the datapoints.
• Boundary line: Boundary lines are the two lines apart from hyperplane, which creates a
margin for datapoints.
• Support vectors: Support vectors are the datapoints which are nearest to the hyperplane
and opposite class.

Decision Tree Regression in Machine Learning


• Decision Tree is a supervised learning algorithm which can be used for solving both
classification and regression problems.
• It can solve problems for both categorical and numerical data.
• Decision Tree regression builds a tree-like structure in which each internal node represents
the "test" for an attribute, each branch represent the result of the test, and each leaf node
represents the final decision or result.
• A decision tree is constructed starting from the root node/parent node (dataset), which
splits into left and right child nodes (subsets of dataset). These child nodes are further
divided into their children node, and themselves become the parent node of those nodes.

26
Random Forest Regression in Machine Learning
• Random forest is one of the most powerful supervised learning algorithms which is
capable of performing regression as well as classification tasks.
• The Random Forest regression is an ensemble learning method which combines
multiple decision trees and predicts the final output based on the average of each
tree output. The combined decision trees are called as base models, and it can be
represented more formally as: g(x)= f (x)+ f (x)+ f (x)+...
• Random forest uses Bagging or Bootstrap Aggregation technique of ensemble
learning in which aggregated decision tree runs in parallel and do not interact with
each other.

Ridge Regression in Machine Learning


• Ridge regression is one of the most robust versions of linear regression in which a small
amount of bias is introduced so that we can get better long term predictions.
• The amount of bias added to the model is known as Ridge Regression penalty. We can
compute this penalty term by multiplying with the lambda to the squared weight of each
individual features.

Lasso Regression in Machine Learning


• Lasso regression is another regularization technique to reduce the complexity of the model.
• It is similar to the Ridge Regression except that penalty term contains only the absolute
weights instead of a square of weights.
• Since it takes absolute values, hence, it can shrink the slope to 0, whereas Ridge Regression
can only shrink it near to 0.
• It is also called as L1 regularization.

27
Logistic Regression in Machine Learning
• Logistic regression is one of the most popular Machine Learning algorithms, which comes
under the Supervised Learning technique. It is used for predicting the categorical dependent
variable using a given set of independent variables.
• Logistic regression predicts the output of a categorical dependent variable. Therefor the
outcome must be a categorical or discrete value. It can be either Yes or No, 0 or 1, true or
False, etc. but instead of giving the exact value as 0 and 1, it gives the probabilistic values
which lie between 0 and 1.
• Logistic Regression is much similar to the Linear Regression except that how they are used.
Linear Regression is used for solving Regression problems, whereas Logistic regression is
used for solving the classification problems.
• In Logistic regression, instead of fitting a regression line, we fit an "S" shaped logistic
function, which predicts two maximum values (0 or 1).
• The curve from the logistic function indicates the likelihood of something such as whether
the cells are cancerous or not, a mouse is obese or not based on its weight, etc.
• Logistic Regression is a significant machine learning algorithm because it has the ability to
provide probabilities and classify new data using continuous and discrete datasets.
• Logistic Regression can be used to classify the observations using different types of data and
can easily determine the most effective variables used for the classification. The below image
is showing the logistic function:

Logistic Function (Sigmoid Function):


• The sigmoid function is a mathematical function used to map the predicted values to
probabilities.
• It maps any real value into another value within a range of 0 and 1.
• The value of the logistic regression must be between 0 and 1, which cannot go beyond this
limit, so it forms a curve like the "S" form. The S-form curve is called the Sigmoid function or
the logistic function.
• In logistic regression, we use the concept of the threshold value, which defines the
probability of either 0 or 1. Such as values above the threshold value tends to 1, and a value
below the threshold values tends to 0.

28
Assumptions for Logistic Regression:
• The dependent variable must be categorical in nature.
• The independent variable should not have multi-collinearity.

Type of Logistic Regression:

On the basis of the categories, Logistic Regression can be classified into three types:

Binomial: In binomial Logistic regression, there can be only two possible types of the
dependent variables, such as 0 or 1, Pass or Fail, etc.
Multinomial: In multinomial Logistic regression, there can be 3 or more possible unordered
types of the dependent variable, such as "cat", "dogs", or "sheep"
Ordinal: In ordinal Logistic regression, there can be 3 or more possible ordered types of
dependent variables, such as "low", "Medium", or "High".

Regression Analysis in Machine learning


Regression analysis is a statistical method to model the relationship between a dependent
(target) and independent (predictor) variables with one or more independent variables.
More specifically, Regression analysis helps us to understand how the value of the
dependent variable is changing corresponding to an independent variable when other
independent variables are held fixed. It predicts continuous/real values such as temperature,
age, salary, price, etc.
Example: Suppose there is a marketing company A, who does various advertisement every
year and get sales on that. The below list shows the advertisement made by the company in
the last 5 years and the corresponding sales:

29
Regression is a supervised learning technique which helps in finding the correlation between
variables and enables us to predict the continuous output variable based on the one or more
predictor variables. It is mainly used for prediction, forecasting, time series modelling, and
determining the causal-effect relationship between variables.

In Regression, we plot a graph between the variables which best fits the given datapoints,
using this plot, the machine learning model can make predictions about the data. In simple
words, "Regression shows a line or curve that passes through all the datapoints on target-
predictor graph in such a way that the vertical distance between the datapoints and the
regression line is minimum." The distance between datapoints and line tells whether a
model has captured a strong relationship or not.

Some examples of regression can be as:

• Prediction of rain using temperature and other factors


• Determining Market trends
• Prediction of road accidents due to rash driving.

Terminologies Related to the Regression Analysis:

Dependent Variable: The main factor in Regression analysis which we want to predict or
understand is called the dependent variable. It is also called target variable.
Independent Variable: The factors which affect the dependent variables or which are used
to predict the values of the dependent variables are called independent variable, also called
as a predictors
Outliers: Outlier is an observation which contains either very low value or very high value in
comparison to other observed values. An outlier may hamper the result, so it should be
avoided.
Multicollinearity: If the independent variables are highly correlated with each other than
other variables, then such condition is called Multicollinearity. It should not be present in the
dataset, because it creates problem while ranking the most affecting variable.
Underfitting and Overfitting: If our algorithm works well with the training dataset but not
well with test dataset, then such problem is called Overfitting. And if our algorithm does not
perform well even with training dataset, then such problem is called underfitting.

30
UNSUPERVISED MACHINE LEARNING
The goal of unsupervised learning is to find the underlying structure of dataset, group that
data according to similarities, and represent that dataset in a compressed format.

Working of Unsupervised Learning

Types of Unsupervised Learning Algorithm

The unsupervised learning algorithm can be further categorized into two types of problems:

Clustering: Clustering is a method of grouping the objects into clusters such that objects
with most similarities remains into a group and has less or no similarities with the objects of
another group. Cluster analysis finds the commonalities between the data objects and
categorizes them as per the presence and absence of those commonalities.
Association: An association rule is an unsupervised learning method which is used for
finding the relationships between variables in the large database. It determines the set of
items that occurs together in the dataset. Association rule makes marketing strategy more

31
effective. Such as people who buy X item (suppose a bread) are also tend to purchase Y
(Butter/Jam) item. A typical example of Association rule is Market Basket Analysis.

Advantages of Unsupervised Learning


• Unsupervised learning is used for more complex tasks as compared to supervised learning
because, in unsupervised learning, we don't have labelled input data.
• Unsupervised learning is preferable as it is easy to get unlabelled data in comparison to
labelled data.
Disadvantages of Unsupervised Learning
• Unsupervised learning is intrinsically more difficult than supervised learning as it does not
have corresponding output.
• The result of the unsupervised learning algorithm might be less accurate as input data is not
labelled, and algorithms do not know the exact output in advance.

Clustering in Machine Learning


Clustering or cluster analysis is a machine learning technique, which groups the unlabelled
dataset. It can be defined as "A way of grouping the data points into different clusters, consisting of
similar data points. The objects with the possible similarities remain in a group that has less or no
similarities with another group."

It is an unsupervised learning method hence no supervision is provided to the algorithm, and


it deals with the unlabelled dataset.

The clustering technique is commonly used for statistical data analysis.


The clustering technique can be widely used in various tasks. Some most common uses of
this technique are:
• Market Segmentation
• Statistical data analysis
• Social network analysis
• Image segmentation
• Anomaly detection, etc.

32
Types of Clustering Methods

The clustering methods are broadly divided into Hard clustering (datapoint belongs to only one
group) and Soft Clustering (data points can belong to another group also). But there are also other
various approaches of Clustering exist. Below are the main clustering methods used in Machine
learning:

1. Partitioning Clustering

2. Density-Based Clustering

3. Distribution Model-Based Clustering

4. Hierarchical Clustering

5. Fuzzy Clustering
Partitioning Clustering

It is a type of clustering that divides the data into non-hierarchical groups. It is also known as the
centroid-based method. The most common example of partitioning clustering is the K-Means
Clustering algorithm

Distribution Model-Based Clustering

In the distribution model-based clustering method, the data is divided based on the probability of
how a dataset belongs to a particular distribution. The grouping is done by assuming some
distributions commonly Gaussian Distribution.

The example of this type is the Expectation-Maximization Clustering algorithm that uses Gaussian
Mixture Models (GMM).

33
Hierarchical Clustering

Hierarchical clustering can be used as an alternative for the partitioned clustering as there is no
requirement of pre-specifying the number of clusters to be created. In this technique, the dataset is
divided into clusters to create a tree-like structure, which is also called a dendrogram. The
observations or any number of clusters can be selected by cutting the tree at the correct level. The
most common example of this method is the Agglomerative Hierarchical algorithm.

Fuzzy Clustering

Fuzzy clustering is a type of soft method in which a data object may belong to more than one group
or cluster. Each dataset has a set of membership coefficients, which depend on the degree of
membership to be used in a cluster sometimes also known as the Fuzzy k-means algorithm.

34
Clustering Algorithms

K-Means Clustering Algorithm

K-Means Clustering is an unsupervised learning algorithm that is used to solve the clustering
problems in machine learning or data science. In this topic, we will learn what is K-means clustering
algorithm, how the algorithm works, along with the Python implementation of k-means clustering.

The k-means clustering algorithm mainly performs two tasks:

• Determines the best value for K-center points or centroids by an iterative process.
• Assigns each data point to its closest k-center. Those data points which are near to the
particular k-center, create a cluster.

The below diagram explains the working of the K-means Clustering Algorithm:

How does the K-Means Algorithm Work?

The working of the K-Means algorithm is explained in the below steps:

Step-1: Select the number K to decide the number of clusters.

Step-2: Select random K points or centroids. (It can be other from the input dataset).

Step-3: Assign each data point to their closest centroid, which will form the predefined K clusters.

Step-4: Calculate the variance and place a new centroid of each cluster.

Step-5: Repeat the third steps, which means reassign each datapoint to the new closest centroid of
each cluster.

Step-6: If any reassignment occurs, then go to step-4 else go to FINISH.

Step-7: The model is ready.

35
Naive Bayes Classifier in Machine Learning

Naive Bayes Classifier Algorithm

Naïve Bayes algorithm is a supervised learning algorithm, which is based on Bayes theorem and used
for solving classification problems.

It is mainly used in text classification that includes a high-dimensional training dataset.

Some popular examples of Naïve Bayes Algorithm are spam filtration, Sentimental analysis, and
classifying articles

The Naïve Bayes algorithm is comprised of two words Naïve and Bayes, Which can be described as:

Naïve: It is called Naïve because it assumes that the occurrence of a certain feature is independent
of the occurrence of other features. Such as if the fruit is identified on the bases of colour, shape,
and taste, then red, spherical, and sweet fruit is recognized as an apple. Hence each feature
individually contributes to identify that it is an apple without depending on each other.

Bayes: It is called Bayes because it depends on the principle of Bayes' Theorem.

Baye’s Theorem

Bayes' theorem is also known as Bayes' Rule or Bayes' law, which is used to determine the probability
of a hypothesis with prior knowledge. It depends on the conditional probability. The formula for
Bayes' theorem is given as:

36
Principal Component Analysis

Principal Component Analysis is an unsupervised learning algorithm that is used for the
dimensionality reduction in machine learning. It is a statistical process that converts the observations
of correlated features into a set of linearly uncorrelated features with the help of orthogonal
transformation. These new transformed features are called the Principal Components. It is one of the
popular tools that is used for exploratory data analysis and predictive modelling. It is a technique to
draw strong patterns from the given dataset by reducing the variances.

PCA generally tries to find the lower-dimensional surface to project the high dimensional data. The
PCA algorithm is based on some mathematical concepts such as:

• Variance and Covariance


• Eigenvalues and Eigen factors

Some common terms used in PCA algorithm:

Dimensionality: It is the number of features or variables present in the given dataset. More easily, it
is the number of columns present in the dataset.

Correlation: It signifies that how strongly two variables are related to each other. Such as if one
changes, the other variable also gets changed. The correlation value ranges from -1 to +1. Here, -1
occurs if variables are inversely proportional to each other, and +1 indicates that variables are
directly proportional to each other.

Orthogonal: It defines that variables are not correlated to each other, and hence the correlation
between the pair of variables is zero.

Eigenvectors: If there is a square matrix M, and a non-zero vector v is given. Then v will be
eigenvector if Av is the scalar multiple of v.

Covariance Matrix: A matrix containing the covariance between the pair of variables is called the
Covariance Matrix.
Steps for PCA algorithm

• Getting the dataset


• Representing data into a structure
• Standardizing the data
• Calculating the Covariance of Z
• Calculating the Eigen Values and Eigen Vectors
• Sorting the Eigen Vectors
• Calculating the new features Or Principal Components
• Remove less or unimportant features from the new dataset.

37
Applications of Machine Learning

Machine learning is one of the most exciting technologies that one would have ever come across.
As is evident from the name, it gives the computer that which makes it more similar to humans:
The ability to learn. Machine learning is actively being used today, perhaps in many more places
than one would expect.

Image Recognition

One of the most notable machine learning applications is image recognition, which is a method for
Catalog and detecting an object or feature in a digital image. In addition, this technique is used for
further analysis, such as pattern recognition, face detection, and face recognition.

Speech Recognition
ML software can make measurements of words spoken using a collection of numbers that represent
the speech signal. Popular applications that employ speech recognition include Amazon’s Alexa,
Apple’s Siri, and Google Maps ML software can make measurements of words spoken using a
collection of numbers that.

Cancer Prognosis and Prediction

As ML algorithms can identify critical traits in complicated datasets, it is applied in cancer research. It
is used to construct prediction models using techniques like Artificial Neural Networks (ANNs),
Bayesian Networks (BNs), and Decision Trees (DTs). This helps in precise decision-making and
modelling of the evolution and therapy of malignant diseases.

Fraud Detection

Fraud prevention is one of the most significant uses of machine learning in the banking and finance
industry. This technology is implemented to search through large volumes of transactional data and
spot patterns for unusual behaviour. Every purchase a customer makes is evaluated in real-time, and
the likelihood that the transaction is fraudulent is indicated by a fraud score. The transaction is
subsequently blocked or frozen for manual examination in the event of a fraudulent transaction. This
entire process takes place in just a few seconds.

E-Commerce and Product Recommendation

One of the prominent elements of typically any e-commerce website is product recommendation,
which involves the sophisticated use of machine learning algorithms. Websites track customer
behaviour based on past purchases, browsing habits, and cart history and then recommend products
using machine learning and AI.

38
39
CONCLUSION

As I conclude my internship journey, I am filled with gratitude for the invaluable


experiences and knowledge I gained during this period. My time at Chip
Electronics was more than just an internship; it was a transformative
experience that broadened my horizons, refined my skills, and deepened my
passion for innovation. I am excited to carry forward the lessons and memories
from this internship as I embark on the next chapter of my journey, equipped
with a newfound appreciation for hands-on learning, creativity, and the
boundless possibilities of technology. At the intersection of innovation and
connectivity, my internship journey at Chip Electronics proved to be an
enlightening and transformative experience. With a focus on hands-on training
and a dynamic environment, my time at Chip Electronics immersed me in
Machine Learning.
Beyond technical skills, the internship has also fostered my professional
development. I have enhanced my communication and teamwork abilities by
interacting with diverse teams, effectively articulating my ideas, and actively
contributing to collaborative projects. I have also developed a strong work
ethic, adapting to demanding deadlines and managing my time effectively.
I will seek out opportunities to apply my knowledge and skills in real-world
settings, contributing to meaningful projects and making a positive impact on
the world through Machine Learning.

40

You might also like