Machine Learning Unit 1 Notes PDF

Summary

These are notes on Machine Learning, covering definitions, types of machine learning, and examples. The notes discuss supervised, unsupervised, reinforcement, and semi-supervised learning.

Full Transcript

MACHINE LEARNING UNIT – I NOTES Introduction to Machine Learning: Definition of Machine Learning, Definition of learning. Classification of Machine Learning: Supervised learning, unsupervised learning, Reinforcement learning, Semi-supervised learning. Categorizing based on required Output...

MACHINE LEARNING UNIT – I NOTES Introduction to Machine Learning: Definition of Machine Learning, Definition of learning. Classification of Machine Learning: Supervised learning, unsupervised learning, Reinforcement learning, Semi-supervised learning. Categorizing based on required Output: Classification, Regression, and Clustering. Difference in ML and Traditional Programming, Definition of Data, Information and Knowledge. Split data in Machine Learning: Training Data, Validation Data and Testing Data. Machine Learning: Applications Introduction In the real world, we are surrounded by humans who can learn everything from their experiences with their learning capability, and we have computers or machines which work on our instructions. But can a machine also learn from experiences or past data like a human does? So here comes the role of Machine Learning. Definition of Machine Learning Arthur Samuel, an early American leader in the field of computer gaming and artificial intelligence, coined the term “Machine Learning” in 1959 while at IBM. He defined machine learning as “the field of study that gives computers the ability to learn without being explicitly programmed.” However, there is no universally accepted definition for machine learning. Different authors define the term differently. We give below two more definitions. Machine learning is programming computers to optimize a performance criterion using example data or past experience. We have a model defined up to some parameters, and learning is the execution of a computer program to optimize the parameters of the model using the training data or past experience. The field of study known as machine learning is concerned with the question of how to construct computer programs that automatically improve with experience. In the above definitions we have used the term “model” and we will be using this term at several contexts later. It appears that there is no universally accepted one sentence definition of this term. Loosely, it may be understood as some mathematical expression or equation, or some mathematical structures such as graphs and trees, or a division of sets into disjoint subsets, or a set of logical “if... then... else...” rules, or some such thing. It may be noted that this is not an exhaustive list. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 1 MACHINE LEARNING UNIT – I NOTES Definition of learning: A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks T, as measured by P, improves with experience E. Learning is any process by which a system improves performance from experience. Identifying patterns. Recognizing those patterns when you see them again. Examples: i) Handwriting recognition learning problem  Task T: Recognizing and classifying handwritten words within images  Performance P: Percent of words correctly classified  Training experience E: A dataset of handwritten words with given classifications ii) A robot driving learning problem  Task T: Driving on highways using vision sensors  Performance measure P: Average distance traveled before an error  training experience: A sequence of images and steering commands recorded while observing a human driver iii) A chess learning problem Task T: Playing chess Performance measure P: Percent of games won against opponents Training experience E: Playing practice games against itself A computer program which learns from experience is called a machine learning program or simply a learning program. Such a program is sometimes also referred to as a learner. A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P , if its performance at tasks T, as measured by P , improves with experience E. “Learning is any process by which a system improves performance from experience.” Herbert Simon Definition by Tom Mitchell (1998): Machine Learning is the study of algorithms that improve their performance P at some task T With experience E. A well- defined learning task is given by Improve on task T, with respect to performance metric P, based on experience E BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 2 MACHINE LEARNING UNIT – I NOTES T: Playing checkers P: Percentage of games won against an arbitrary opponent E: Playing practice games against itself T: Recognizing hand-written words P: Percentage of words correctly classified E: Database of human-labeled images of handwritten words T: Driving on four-lane highways using vision sensors P: Average distance traveled before a human-judged error E: A sequence of images and steering commands recorded while observing a human driver. T: Categorize email messages as spam or legitimate. P: Percentage of email messages correctly classified. E: Database of emails, some with human-given labels Machine Learning is an application of Artificial Intelligence that enables systems to learn from vast volumes of data and solve specific problems. It uses computer algorithms that improve their efficiency automatically through experience. How machines learn? Basic components of learning process: The learning process, whether by a human or a machine, can be divided into four components, namely, data storage, abstraction, generalization and evaluation. Figure 1.1 illustrates the various components and the steps involved in the learning process. Data storage: Facilities for storing and retrieving huge amounts of data are an important component of the learning process. Humans and computers alike utilize data storage as a foundation for advanced reasoning. In a human being, the data is stored in the brain and data is retrieved using electrochemical signals. Computers use hard disk drives, flash memory, random access memory and similar devices to store data and use cables and other technology to retrieve data. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 3 MACHINE LEARNING UNIT – I NOTES Abstraction The second component of the learning process is known as abstraction. Abstraction is the process of extracting knowledge about stored data. This involves creating general concepts about the data as a whole. The creation of knowledge involves application of known models and creation of new models. The process of fitting a model to a dataset is known as training. When the model has been trained, the data is transformed into an abstract form that summarizes the original information. Generalization The third component of the learning process is known as generalization. The term generalization describes the process of turning the knowledge about stored data into a form that can be utilized for future action. These actions are to be carried out on tasks that are similar, but not identical, to those what have been seen before. In generalization, the goal is to discover those properties of the data that will be most relevant to future tasks. Evaluation Evaluation is the last component of the learning process. It is the process of giving feedback to the user to measure the utility of the learned knowledge. This feedback is then utilised to effect improvements in the whole learning process. How does Machine Learning work? A Machine Learning system learns from historical data, builds the prediction models, and whenever it receives new data, predicts the output for it. The accuracy of predicted output depends upon the amount of data, as the huge amount of data helps to build a better model which predicts the output more accurately. Suppose we have a complex problem, where we need to perform some predictions, so instead of writing a code for it, we just need to feed the data to generic algorithms, and with the help of these algorithms, machine builds the logic as per the data and predict the output. Machine learning has changed our way of thinking about the problem. The below block diagram explains the working of Machine Learning algorithm: The below block diagram explains the working of Machine Learning algorithm: BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 4 MACHINE LEARNING UNIT – I NOTES Need for Machine Learning The need for machine learning is increasing day by day. The reason behind the need for machine learning is that it is capable of doing tasks that are too complex for a person to implement directly. As a human, we have some limitations as we cannot access the huge amount of data manually, so for this, we need some computer systems and here comes the machine learning to make things easy for us. We can train machine learning algorithms by providing them the huge amount of data and let them explore the data, construct the models, and predict the required output automatically. The performance of the machine learning algorithm depends on the amount of data, and it can be determined by the cost function. With the help of machine learning, we can save both time and money. The importance of machine learning can be easily understood by its uses cases, currently, machine learning is used in self-driving cars, cyber fraud detection, face recognition, and friend suggestion by Facebook, etc. Various top companies such as Netflix and Amazon have built machine learning models that are using a vast amount of data to analyze the user interest and recommend product accordingly. How to get started with Machine Learning? To get started, let’s take a look at some of the important terminologies. Terminology:  Model: Also known as “hypothesis”, a machine learning model is the mathematical representation of a real-world process. A machine learning algorithm along with the training data builds a machine learning model.  Feature: A feature is a measurable property or parameter of the data-set.  Feature Vector: It is a set of multiple numeric features. We use it as an input to the machine learning model for training and prediction purposes.  Training: An algorithm takes a set of data known as “training data” as input. The learning algorithm finds patterns in the input data and trains the model for expected results (target). The output of the training process is the machine learning model.  Prediction: Once the machine learning model is ready, it can be fed with input data to provide a predicted output.  Target (Label): The value that the machine learning model has to predict is called the target or label.  Over fitting: When a model performs very well for training data but has poor performance with test data (new data), it is known as over fitting. In this case, the BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 5 MACHINE LEARNING UNIT – I NOTES machine learning model learns the details and noise in the training data such that it negatively affects the performance of the model on test data. Over fitting can happen due to low bias and high variance.  Under fitting: When a model has not learned the patterns in the training data well and is unable to generalize well on the new data, it is known as under fitting. An under fit model has poor performance on the training data and will result in unreliable predictions. Under fitting occurs due to high bias and low variance. 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: 1. Gathering Data 2. Preparing that data 3. Choosing a model 4. Training 5. Evaluation 6. Hyper parameter Tuning 7. Prediction Machine Learning Steps The task of imparting intelligence to machines seems daunting and impossible. But it is actually really easy. It can be broken down into 7 major steps: 1. Collecting Data: - As you know, machines initially learn from the data that you give them. It is of the utmost importance to collect reliable data so that your machine learning model can find the correct patterns. The quality of the data that you feed to the machine will determine how accurate your model is. If you have incorrect or outdated data, you will have wrong outcomes or predictions which are not relevant. Make sure you use data from a reliable source, as it will directly affect the outcome of your model. Good data is relevant, contains very few missing and repeated values, and has a good representation of the various subcategories/classes present BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 6 MACHINE LEARNING UNIT – I NOTES Figure 1: Collecting Data 2. Preparing the Data: - After you have your data, you have to prepare it. You can do this by:  Putting together all the data you have and randomizing it. This helps make sure that data is evenly distributed, and the ordering does not affect the learning process.  Cleaning the data to remove unwanted data, missing values, rows, and columns, duplicate values, data type conversion, etc. You might even have to restructure the dataset and change the rows and columns or index of rows and columns.  Visualize the data to understand how it is structured and understand the relationship between various variables and classes present.  Splitting the cleaned data into two sets - a training set and a testing set. The training set is the set your model learns from. A testing set is used to check the accuracy of your model after training. Figure 2: Cleaning and Visualizing Data 3. Choosing a Model: - A machine learning model determines the output you get after running a machine learning algorithm on the collected data. It is important to choose a model which is relevant to the task at hand. Over the years, scientists and engineers developed various models suited for different tasks like speech recognition, image recognition, prediction, etc. Apart from this, you also have to see if your model is suited for numerical or categorical data and choose accordingly. Figure 3: Choosing a model BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 7 MACHINE LEARNING UNIT – I NOTES 4. Training the Model: - Training is the most important step in machine learning. In training, you pass the prepared data to your machine learning model to find patterns and make predictions. It results in the model learning from the data so that it can accomplish the task set. Over time, with training, the model gets better at predicting. Figure 4: Training a model 5. Evaluating the Model: - After training your model, you have to check to see how it’s performing. This is done by testing the performance of the model on previously unseen data. The unseen data used is the testing set that you split our data into earlier. If testing was done on the same data which is used for training, you will not get an accurate measure, as the model is already used to the data, and finds the same patterns in it, as it previously did. This will give you disproportionately high accuracy. When used on testing data, you get an accurate measure of how your model will perform and its speed. Figure 5: Evaluating a model 6. Parameter Tuning: - Once you have created and evaluated your model, see if its accuracy can be improved in any way. This is done by tuning the parameters present in your model. Parameters are the variables in the model that the programmer generally decides. At a particular value of your parameter, the accuracy will be the maximum. Parameter tuning refers to finding these values. Figure 6: Parameter Tuning BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 8 MACHINE LEARNING UNIT – I NOTES 7. Making Predictions: - In the end, you can use your model on unseen data to make predictions accurately. Key Concepts of Machine Learning: Machine learning revolves around several key concepts that form the foundation of its methodologies and applications: 1. Training Data: Training data is the set of examples used to train a machine learning model. It consists of input-output pairs, where inputs are the features (descriptive attributes) of the data, and outputs are the corresponding labels or target values that the model aims to predict. 2. Features: Features are the individual measurable properties or characteristics of the data used as input for a machine learning model. They represent the variables that the model will analyze to make predictions or decisions. Features can include numerical values, categorical attributes, text, images, etc. 3. Labels: Labels are the output or target values associated with each example in the training data. In supervised learning tasks, models learn to map input features to corresponding labels. For example, in a classification task, labels might represent different classes or categories, while in a regression task, labels are typically continuous values. 3. Models: Models in machine learning are mathematical representations or algorithms that learn patterns and relationships from the training data. These models capture the underlying structure of the data and can make predictions or decisions on new, unseen data. Examples of machine learning models include linear regression, decision trees, support vector machines, neural networks, and more advanced deep learning architectures. 4. Predictions: Predictions are the outputs generated by a trained machine learning model when provided with new, unseen data. The model uses the patterns learned during training to make predictions about the corresponding labels or target values for the given input features. 1.1.2 Applications of machine learning Given below are some real examples of ML: Example 1: If you have used Netflix, then you must know that it recommends you some movies or shows for watching based on what you have watched earlier. Machine Learning is used for BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 9 MACHINE LEARNING UNIT – I NOTES this recommendation and to select the data which matches your choice. It uses the earlier data. Example 2: The second example would be Facebook. When you upload a photo on Facebook, it can recognize a person in that photo and suggest you, mutual friends. ML is used for these predictions. It uses data like your friend-list, photos available etc. and it makes predictions based on that. Example 3: The third example is Software, which shows how you will look when you get older. This image processing also uses machine learning. Below are some most trending real-world applications of Machine Learning: 1. Image Recognition: - Image recognition is one of the most common applications of machine learning. It is used to identify objects, persons, places, digital images, etc. The popular use case of image recognition and face detection is, Automatic friend tagging suggestion. Facebook provides us a feature of auto friend tagging suggestion. Whenever we upload a photo with our Facebook friends, then we automatically get a tagging suggestion with name, and the technology behind this is machine learning's face detection and recognition algorithm. It is based on the Facebook project named "Deep Face," which is responsible for face recognition and person identification in the picture. 2. Speech Recognition: - While using Google, we get an option of "Search by voice," it comes under speech recognition, and it's a popular application of machine learning. Speech recognition is a process of converting voice instructions into text, and it is also known as "Speech to text", or "Computer speech recognition." At present, machine learning algorithms are widely used by various applications of speech recognition. Google assistant, Siri, Cortana, and Alexa are using speech recognition technology to follow the voice instructions. 3. Traffic prediction: - If we want to visit a new place, we take help of Google Maps, which shows us the correct BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 10 MACHINE LEARNING UNIT – I NOTES path with the shortest route and predicts the traffic conditions. It predicts the traffic conditions such as whether traffic is cleared, slow-moving, or heavily congested with the help of two ways: Real Time location of the vehicle form Google Map app and sensors Average time has taken on past days at the same time. Everyone who is using Google Map is helping this app to make it better. It takes information from the user and sends back to its database to improve the performance. 4. Product recommendations: - Machine learning is widely used by various e-commerce and entertainment companies such as Amazon, Netflix, etc., for product recommendation to the user. Whenever we search for some product on Amazon, then we started getting an advertisement for the same product while internet surfing on the same browser and this is because of machine learning. Google understands the user interest using various machine learning algorithms and suggests the product as per customer interest. As similar, when we use Netflix, we find some recommendations for entertainment series, movies, etc., and this is also done with the help of machine learning. 5. Self-driving cars: - One of the most exciting applications of machine learning is self-driving cars. Machine learning plays a significant role in self-driving cars. Tesla, the most popular car manufacturing company is working on self-driving car. It is using unsupervised learning method to train the car models to detect people and objects while driving. 6. Email Spam and Malware Filtering: - Whenever we receive a new email, it is filtered automatically as important, normal, and spam. We always receive an important mail in our inbox with the important symbol and spam emails in our spam box, and the technology behind this is Machine learning. Below are some spam filters used by Gmail: Content Filter Header filter General blacklists filter Rules-based filters BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 11 MACHINE LEARNING UNIT – I NOTES Permission filters Some machine learning algorithms such as Multi-Layer Perceptron, Decision tree, and Naïve Bayes classifier are used for email spam filtering and malware detection. 7. Virtual Personal Assistant: - We have various virtual personal assistants such as Google assistant, Alexa, Cortana, Siri. As the name suggests, they help us in finding the information using our voice instruction. These assistants can help us in various ways just by our voice instructions such as Play music, call someone, Open an email, Scheduling an appointment, etc. These virtual assistants use machine learning algorithms as an important part. These assistant record our voice instructions, send it over the server on a cloud, and decode it using ML algorithms and act accordingly. 8. Online Fraud Detection: - Machine learning is making our online transaction safe and secure by detecting fraud transaction. Whenever we perform some online transaction, there may be various ways that a fraudulent transaction can take place such as fake accounts, fake ids, and steal money in the middle of a transaction. So to detect this, Feed Forward Neural network helps us by checking whether it is a genuine transaction or a fraud transaction. For each genuine transaction, the output is converted into some hash values, and these values become the input for the next round. For each genuine transaction, there is a specific pattern which gets change for the fraud transaction hence, it detects it and makes our online transactions more secure. 9. Stock Market trading: - Machine learning is widely used in stock market trading. In the stock market, there is always a risk of up and downs in shares, so for this machine learning's long short term memory neural network is used for the prediction of stock market trends. 10. Medical Diagnosis: - In medical science, machine learning is used for diseases diagnoses. With this, medical technology is growing very fast and able to build 3D models that can predict the exact position of lesions in the brain. It helps in finding brain tumors and other brain-related diseases easily. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 12 MACHINE LEARNING UNIT – I NOTES 11. Automatic Language Translation: - Nowadays, if we visit a new place and we are not aware of the language then it is not a problem at all, as for this also machine learning helps us by converting the text into our known languages. Google's GNMT (Google Neural Machine Translation) provide this feature, which is a Neural Machine Learning that translates the text into our familiar language, and it called as automatic translation. The technology behind the automatic translation is a sequence to sequence learning algorithm, which is used with image recognition and translates the text from one language to another language. 12. Analyzing the user’s feedback using Sentiment Analysis: - Sentiment analysis is a top-notch machine learning application that refers to sentiment classification, opinion mining, and analyzing emotions. Using this model, machines groom themselves to analyze sentiments based on the words. They can identify if the words are said in a positive, negative, or neutral notion. Also, they can define the magnitude of these words. With the help of the process called Natural Language Processing (NLP), data-miners automatically extract and conclude the opinion by analyzing both types of machine learning algorithms – supervised and unsupervised data. Companies that are dealing with customers use this model to improve customer experience based on feedback. Another machine learning example is – Music applications. Apps like Ganna.com, Jiosaavn also suggest music based on user sentiments by analyzing the history of songs played, favorite playlists, and even the time of listings music. Application of machine learning methods to large databases is called data mining. In data mining, a large volume of data is processed to construct a simple model with valuable use, for example, having high predictive accuracy. The following is a list of some of the typical applications of machine learning. 1. In retail business, machine learning is used to study consumer behavior. 2. In finance, banks analyze their past data to build models to use in credit applications, fraud detection, and the stock market. 3. In manufacturing, learning models are used for optimization, control, and troubleshooting. 4. In medicine, learning programs are used for medical diagnosis. 5. In telecommunications, call patterns are analyzed for network optimization and maximizing the quality of service. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 13 MACHINE LEARNING UNIT – I NOTES 6. In science, large amounts of data in physics, astronomy, and biology can only be analyzed fast enough by computers. The World Wide Web is huge; it is constantly growing and searching for relevant information cannot be done manually. 7. In artificial intelligence, it is used to teach a system to learn and adapt to changes so that the system designer need not foresee and provide solutions for all possible situations. 8. It is used to find solutions to many problems in vision, speech recognition, and robotics. 9. Machine learning methods are applied in the design of computer-controlled vehicles to steer correctly when driving on a variety of roads. 10. Machine learning methods have been used to develop programmes for playing games such as chess, backgammon and Go. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 14 MACHINE LEARNING UNIT – I NOTES Types of Machine Learning Algorithms: - 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 Supervised Machine Learning: - Supervised learning is the types of machine learning in which machines are trained using well "labelled" training data, and on basis of that data, machines predict the output. The labelled data means some input data is already tagged with the correct output. In supervised learning, the training data provided to the machines work as the supervisor that teaches the machines to predict the output correctly. It applies the same concept as a student learns in the supervision of the teacher. Supervised learning is a process of providing input data as well as correct output data to the machine learning model. The aim of a supervised learning algorithm is to find a mapping function to map the input variable(x) with the output variable(y). In the real-world, supervised learning can be used for Risk Assessment, Image classification, Fraud Detection, spam filtering, etc. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 15 MACHINE LEARNING UNIT – I NOTES 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: Suppose we have a dataset of different types of shapes which includes square, rectangle, triangle, and Polygon. Now the first step is that we need to train the model for each shape. If the given shape has four sides, and all the sides are equal, then it will be labelled as a Square. If the given shape has three sides, then it will be labelled as a triangle. If the given shape has six equal sides then it will be labelled as hexagon. Now, after training, we test our model using the test set, and the task of the model is to identify the shape. The machine is already trained on all types of shapes, and when it finds a new shape, it classifies the shape on the bases of a number of sides, and predicts the output. Training the system: - While training the model, data is usually split in the ratio of 80:20 i.e. 80% as training data and the rest as testing data. In training data, we feed input as well as output for 80% of data. The model learns from training data only. We use different machine learning algorithms (which we will discuss in detail in the next articles) to build our model. Learning means that the model will build some logic of its own. Once the model is ready then it is good to be tested. At the time of testing, the input is fed from the remaining 20% of data that the model has never seen before, the model will predict some value and we will compare it with the actual output and calculate the accuracy. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 16 MACHINE LEARNING UNIT – I NOTES 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. Types of Supervised Machine learning Algorithms: Supervised learning can be further divided into two types of problems: 1. 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 2. 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. Below are some popular classification algorithms which come under supervised learning:  Random Forest  Decision Trees  Logistic Regression  Support vector Machines BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 17 MACHINE LEARNING UNIT – I NOTES 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. 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. Unsupervised Machine Learning: - In the previous topic, we learned supervised machine learning in which models are trained using labeled data under the supervision of training data. But there may be many cases in which we do not have labeled data and need to find the hidden patterns from the given dataset. So, to solve such types of cases in machine learning, we need unsupervised learning techniques. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 18 MACHINE LEARNING UNIT – I NOTES Unsupervised Learning: As the name suggests, unsupervised learning is a machine learning technique in which models are not supervised using training dataset. Instead, models itself find the hidden patterns and insights from the given data. It can be compared to learning which takes place in the human brain while learning new things. It can be defined as: Unsupervised learning is a type of machine learning in which models are trained using unlabeled dataset and are allowed to act on that data without any supervision. Unsupervised learning cannot be directly applied to a regression or classification problem because unlike supervised learning, we have the input data but no corresponding output data. 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. Example: Suppose the unsupervised learning algorithm is given an input dataset containing images of different types of cats and dogs. The algorithm is never trained upon the given dataset, which means it does not have any idea about the features of the dataset. The task of the unsupervised learning algorithm is to identify the image features on their own. Unsupervised learning algorithm will perform this task by clustering the image dataset into the groups according to similarities between images. Why use Unsupervised Learning? Below are some main reasons which describe the importance of Unsupervised Learning:  Unsupervised learning is helpful for finding useful insights from the data.  Unsupervised learning is much similar as a human learns to think by their own experiences, which makes it closer to the real AI.  Unsupervised learning works on unlabeled and uncategorized data which make unsupervised learning more important.  In real-world, we do not always have input data with the corresponding output so to solve such cases, we need unsupervised learning. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 19 MACHINE LEARNING UNIT – I NOTES Working of Unsupervised Learning Working of unsupervised learning can be understood by the below diagram: Here, we have taken an unlabeled input data, which means it is not categorized and corresponding outputs are also not given. Now, this unlabeled input data is fed to the machine learning model in order to train it. Firstly, it will interpret the raw data to find the hidden patterns from the data and then will apply suitable algorithms such as k-means clustering, Decision tree, etc. Once it applies the suitable algorithm, the algorithm divides the data objects into groups according to the similarities and difference between the objects. Types of Unsupervised Learning Algorithm: The unsupervised learning algorithm can be further categorized into two types of problems: 1. 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. 2. 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 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. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 20 MACHINE LEARNING UNIT – I NOTES Unsupervised Learning algorithms: Below is the list of some popular unsupervised learning algorithms:  K-means clustering  KNN (k-nearest neighbors)  Hierarchal clustering  Anomaly detection  Neural Networks  Principle Component Analysis  Independent Component Analysis  Apriori algorithm 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 labeled input data. Unsupervised learning is preferable as it is easy to get unlabeled data in comparison to labeled 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 labeled, and algorithms do not know the exact output in advance. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 21 MACHINE LEARNING UNIT – I NOTES Difference between Supervised and Unsupervised Learning Supervised and Unsupervised learning are the two techniques of machine learning. But both the techniques are used in different scenarios and with different datasets. Below the explanation of both learning methods along with their difference table is given. The main differences between Supervised and Unsupervised learning are given below: Supervised vs. Unsupervised Machine Learning: Sr. Unsupervised Machine Parameters Supervised Machine Learning No. Learning 1 Input Data Algorithms are trained using Algorithms are used against labeled data. data that is not labeled 2 Computational Simpler method Computationally complex Complexity 3 Accuracy Highly accurate Less accurate 4 No. of classes No. of classes is known No. of classes is not known 5 Data Analysis Uses offline analysis Uses real-time analysis of data 6 Algorithms used Linear and Logistics regression, K-Means clustering, Hierarchical Random forest, Support Vector clustering, Apriori algorithm, Machine, Neural Network, etc. etc. 7 Output Desired output is given. Desired output is not given. 8 Training data Use training data to infer model. No training data is used. 9 Complex model It is not possible to learn larger It is possible to learn larger and and more complex models than more complex models with with supervised learning. unsupervised learning. 10 Model We can test our model. We cannot test our model. 11 Called as Supervised learning is also called Unsupervised learning is also classification. called clustering. 12 Example Example: Optical character Example: Find a face in an recognition. image. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 22 MACHINE LEARNING UNIT – I NOTES 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 unlabeled datasets during the training period. Although Semi-supervised learning is the middle ground between supervised and unsupervised learning and operates on the data that consists of a few labels, it mostly consists of unlabeled data. As labels are costly, but for corporate purposes, they may have few labels. It is completely different from supervised and unsupervised learning as they are based on the presence & absence of labels. To overcome the drawbacks of supervised learning and unsupervised learning algorithms, the concept of Semi-supervised learning is introduced. The main aim of semi-supervised learning is to effectively use all the available data, rather than only labelled data like in supervised learning. Initially, similar data is clustered along with an unsupervised learning algorithm, and further, it helps to label the unlabeled data into labelled data. It is because labelled data is a comparatively more expensive acquisition than unlabeled data. We can imagine these algorithms with an example. Supervised learning is where a student is under the supervision of an instructor at home and college. Further, if that student is self-analysing the same concept without any help from the instructor, it comes under unsupervised learning. Under semi-supervised learning, the student has to revise himself after analyzing the same concept under the guidance of an instructor at college. Advantages of Semi-supervised Learning: - It is simple and easy to understand the algorithm. It is highly efficient. It is used to solve drawbacks of Supervised and Unsupervised Learning algorithms. Disadvantages of Semi-supervised Learning: - Iterations results may not be stable. We cannot apply these algorithms to network-level data. Accuracy is low. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 23 MACHINE LEARNING UNIT – I NOTES 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 gets 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. The reinforcement learning process is similar to a human being; for example, a child learns various things by experiences in his day-to-day life. An example of reinforcement learning is to play a game, where the Game is the environment, moves of an agent at each step define states, and the goal of the agent is to get a high score. Agent receives feedback in terms of punishment and rewards. Due to its way of working, reinforcement learning is employed in different fields such as Game theory, Operation Research, Information theory, multi-agent systems. A reinforcement learning problem can be formalized using Markov Decision Process(MDP). In MDP, the agent constantly interacts with the environment and performs actions; at each action, the environment responds and generates a new state. 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 behavior would occur again by adding something. It enhances the strength of the behavior 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 behavior 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 super-human 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. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 24 MACHINE LEARNING UNIT – I NOTES 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. Advantages of Reinforcement Learning: - It helps in solving complex real-world problems which are difficult to be solved by general techniques. The learning model of RL is similar to the learning of human beings; hence most accurate results can be found. Helps in achieving long term results. Disadvantage of Reinforcement Learning: - RL algorithms are not preferred for simple problems. RL algorithms require huge data and computations. -Too much reinforcement learning can lead to an overload of states which can weaken the results. The curse of dimensionality limits reinforcement learning for real physical systems. Learning Associations Association Rule Learning: - 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 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. BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 25 MACHINE LEARNING UNIT – I NOTES Association rule learning is a type of unsupervised learning technique that checks for the dependency of one data item on another data item and maps accordingly so that it can be more profitable. It tries to find some interesting relations or associations among the variables of dataset. It is based on different rules to discover the interesting relations between variables in the database. The association rule learning is one of the very important concepts of machine learning, and it is employed in Market Basket analysis, Web usage mining, continuous production, etc. Here market basket analysis is a technique used by the various big retailers to discover the associations between items. We can understand it by taking an example of a supermarket, as in a supermarket, all products that are purchased together is put together. How does Association Rule Learning work? Association rule learning works on the concept of If and Else Statement, such as if A then B. Here the If element is called antecedent, and then statement is called as Consequent. These types of relationships where we can find out some association or relation between two items is known as single cardinality. It is all about creating rules, and if the number of items increases, then cardinality also increases accordingly. So, to measure the associations between thousands of data items, there are several metrics. These metrics are given below: Support Confidence Lift Let's understand each of them: Support: - Support is the frequency of A or how frequently an item appears in the dataset. It is defined as the fraction of the transaction T that contains the item set X. If there are X datasets, then for transactions T, it can be written as: BTAIC502-Machine Learning Notes by Prof. R. A. Agrawal, SSGBCOE&T, Bhusawal Page 26 MACHINE LEARNING UNIT – I NOTES Confidence: - Confidence indicates how often the rule has been found to be true. Or how often the items X and Y occur together in the dataset when the occurrence of X is already given. It is the ratio of the transaction that contains X and Y to the number of records that contain X. Lift: - It is the strength of any rule, which can be defined as below formula: It is the ratio of the observed support measure and expected support if X and Y are independent of each other. It has three possible values: If Lift= 1: The probability of occurrence of antecedent and consequent is independent of each other. Lift>1: It determines the degree to which the two itemsets are dependent to each other. Lift

Use Quizgecko on...
Browser
Browser