# Role of Machine Learning in Social Area Networks

- Introduction to Machine Learning
- Framework to Develop Machine Learning Models
- Two Phases of Machine Learning
- Types of Machine Learning
- Types of Supervised Learning
- Classification
- Linear Regression
- Logistic Regression
- Types of Unsupervised Learning
- Dimensionality Reduction
- Feature Selection
- Feature Extraction
- Methods of Dimensionality Reduction
- Reinforcement Learning
- Challenges and Limitations of Machine Learning
- Applications of ML

## Introduction to Machine Learning

Currently, there is a high demand for artificial intelligence (AI) to create expert systems and to find solutions for complex problems in applications like recognition, natural language processing, health care, structural engineering, environmental engineering and automotive industries. Machine learning (ML) is a

FIGURE 10.1 Relationship between artificial intelligence and machine learning.

subset of AI that allows software applications to become more precise in the prediction of outcomes without being programmed explicitly. In a nutshell, ML mimics the brain activity of human behavior and has equal computational power once it is programmed effectively. The relationship between AI and ML is shown in Figure 10.1.

ML is defined as a computer program that can adjust to new data without any intervention of human action, and it allows the machine to learn from examples and experience. ML is the logical study of algorithms and arithmetical models that the system uses to perform a particular task depending on patterns and inference. Based on training data, ML algorithms build a model to make predictions [1]. A ML algorithm is used in diverse applications where it is hard to develop an algorithm to perform the task efficiently. ML can be compared to conventional learning. In conventional learning, the input data and program are fed to the computing system where the output depends on the algorithms used. In ML. the input data and the output (trained) are fed to the computing system. The performance of ML applications not only depends on the algorithms used but also depends on various architectures. ML architectures are basically neural network architecture. A strong knowledge in linear algebra, random processes and statistics are required to implement the ML applications effectively. The difference between conventional learning and ML is shown in Figure 10.2.

### Framework to Develop Machine Learning Models

The frame to develop a ML model can be divided into five stages:

- • Problem identification
- • Relevant data collection
- • Preprocessing of data
- • Building the ML model
- • Deployment of model
- •
**Problem Identification**

A good ML project begins with the ability to define the problem clearly. In this stage the domain-specific knowledge of the expert plays a vital role in deploying the project. The major challenge in this stage is to define the right problem statement.

**• Relevant Data Collection**

The relevant data should be identified and collected once the problem statement is defined clearly. The relevant data collection is also called feature extraction. Feature extraction is defined as the process to extract the attributes from different sources that are necessary for developing the ML algorithm. The major challenge in this stage is collection data with high quality.

**• Preprocessing of Data**

In this process the noise is removed and the clarity of the data is enhanced. The collected data should be brought into suitable form for further processing.

**• Building ML Model**

The main objective of this stage is to identify a model that is suitable for the given problem. It may not always be more accurate. To find the best ML model analytical tools and solution procedures are to be strictly carried out to avoid overfitting problems. The final model for deployment is based on accuracy, speed of computation and deployment cost.

**• Deployment of Model**

Once the final model is chosen, the strategy to deploy the model has to be decided. Examples are robots, chatbots, simple action rules and so on.

### Two Phases of Machine Learning

ML consists of two important phases, the training phase and the testing phase. In the training phase the machine learns logic from the input data. More data are used in the training phase, which decides the patterns for future predictions in ML problem. The greater the amount of training data, the better will be the performance accuracy in prediction. In general, the percentage of training data from the complex datasets

FIGURE 10.3 Training and testing phase in machine learning.

can be 80% or 70% or 60% and the corresponding testing samples in the proportion of 20% or 30% or 40%. The testing phase predicts the output from the learned logic for the given input. The proportion of training data and testing data should be selected in such a way that the system should produce optimized result. During the testing phase, if the predicted data has an error, the corresponding testing data should be considered as an additional training data and brought under the training set, which forms a new pattern for further predictions. A schematic representation of the training phase and testing phase are shown in Figure 10.3.

### Types of Machine Learning

The main process of ML is said to be learning from input data that is fed in. The three main types of ML algorithms are supervised learning, unsupervised learning and reinforcement learning. The three types of ML algorithms are shown in Figure 10.4.

#### Types of Supervised Learning

Supervised learning is defined as the task of learning a function from labeled or predetermined training data with proper guidance. Classification, linear regression, logistic regression and discriminant analysis are the types of supervised learning. These algorithms require the knowledge of both input and output variables. The prediction is achieved with the knowledge of actual values of outcome variables.

**TABLE 10.1**

**Example for Supervised Learning**

Serial No. |
Color |
Shape |
Plant Height in cm |
Vegetable |

1 |
Purple |
Oval |
45-60 |
Brinjal |

2 |
Light brown |
Tuber |
100 |
Potato |

3 |
Red |
Round |
1S2 |
Tomato |

4 |
Green |
Oblong |
400 |
Lady’s fingers |

5 |
Yellow |
Elliptical |
304 |
Lemon |

Table Ю.1 depicts an example of a supervised learning model. Table Ю.1 shows the identification of vegetables w'ith their color, shape and plant height as features or patterns. The model has to be fed w'ith color or shape or plant height as patterns or features. Based on the details given, the vegetable will be identified. For example,

- 1.
**Color: Green** - 2.
**Shape: Oblong** - 3.
**Plant height: 400** - 4.
**The identified vegetable is: Lady’s finger**

The color, shape and plant height are fed to the system as patterns for further prediction. The system, which is already trained with known patterns, tries to compare the given input with the known patterns to predict the vegetable. In this case as per the example mentioned above, the predicted vegetable is lady’s finger. Similarly, all the vegetables can be identified from the features or patterns given in the Table 10.1. Colors such as purple, light brow n, red, green and yellow are considered as one of the features for supervised learning. The shapes of vegetables considered for experimentation are oval, tuber, round, oblong and elliptical. Plant height for various plants lies in 45-60 cm for brinjal, 100 cm for potato, 182 cm for tomato, 400 cm for lady’s fingers and 304 cm for lemon.

Figure 10.5 shows the model for supervised learning with the example of identifying brinjal from the table mentioned above.

##### Classification

Classification in ML is defined as the identification of subcategories in which the new data belongs, based on the training set data patterns or features. A good example to illustrate the concept of classification in ML is a remedial class recommendation system that determines whether a student requires remedial class to improve his or her academic performance. The features or patterns considered to implement this ML are the student’s test marks. The output classification categories are less than 50 marks and greater than 50 marks. Students with less than 50 marks fall under the category of remedial class. Students with greater than 50 marks fall under the category of no remedial class. An algorithm that classifies the given input in the prescribed category/features/patterns is called a classifier [2]. Sometimes, the classifier can be represented by a mathematical function.

##### Linear Regression

Linear regression is well-known and well-understood in the fields of statistics and ML. It is also similar to the discrimination problem in the field of engineering. The linear regression method is also known as the discriminative learning method. This deals with the optimization of input parameters using the gradient descent method and the support vector machine method. The linear regression method is used to overcome the classification problems of ML such as overfitting and the bias variance trade-off. The mathematical representation of linear regression is given by the normal straight-line equation, у = *Ax* + B. where A represents the weights and В represents the bias. The most effective way to implement a ML system is to state that the problem should be linearly separable, that is, defined by the hyperplane. For example, from the truth table of AND and OR gates, it can be defined as a linear separable problem, i.e., the hyperplane defines the class 0 and class 1 separately. In case of XOR gate, the hyperplane defines the classes of 0 and 1 in a non-linear manner, so it becomes too complicated to process the XOR gate problem in ML. To resolve this problem, optimization comes into effect and can be carried out using the gradient search method.

##### Logistic Regression

Logistic regression is also a classification algorithm that assigns patterns or features to a discrete set of classes. It is also called the binary classification method which deals with logic 0 and logic 1. The output of logistic regression should be a logic 0 or logic 1. To achieve this, the thresholding or limiting function is used. The thresholding or limiting functions are sigmoid and tangent functions. The process flow of logistic regression includes the weighted sum of the inputs and limiting function. Based on the weights used in the first level of ML architecture, the input fed to the limiting function gets varied. Before feeding the input data to the system, the mathematical function in terms of thresholding logic has to be framed properly. Then, for the set of inputs, the output should be clearly defined from the system. For experimentation the input data can be collected from the sensor devices and after proper conversion, using a suitable analog-to-digital converter, the process of learning starts. For example, take a flu detection system based on body temperature. The system detects whether a person is affected by flu or not. The patterns/features used in this system are body temperature and this system can be used for all humans irrespective of age. If the body temperature is above 97°C, it is predicted that the person has the flu, which lies under the class of logic 1. If the body temperature is below 97°C, it is predicted as the person does not have the flu, which lies under the class of logic 0.

#### Types of Unsupervised Learning

Unsupervised learning is defined as the training of machines without any guidance, i.e., with no predetermined classifications or labeled data. No predetermined patterns are used in unsupervised learning methods. The goal of unsupervised learning is to discern natural groupings in high dimensional data. Unlike supervised learning, there is no intended output or target to which to match the input data. This kind of learning considers only the input data. Dimensionality reduction and clustering are the two types of unsupervised learning. These algorithms do not have knowledge of the outcome variable in the dataset. They should find the possible values of outcome. Because the values of the outcome data are not known previously in training data, supervision using that knowledge is not possible. Figure 10.6 depicts an example of unsupervised learning.

##### Dimensionality Reduction

In MLa problem occurs during classification due to having to consider many factors from which final classification is performed. The factors that are considered in classification are basically variables called features. If the number of factors or features increases, the visualization and working of the training set will be more difficult. This problem is overcome by dimensionality reduction. The definition of

dimensionality reduction is to reduce the number of factors or features under consideration. The dimensionality-reduction approach is divided into feature selection and feature extraction.

##### Feature Selection

Smaller subsets are obtained from the original set of factors or features to model the problem. This is accomplished in three steps as follows: Filtering, Wrapping and Embedding.

##### Feature Extraction

The data in high dimensional space is reduced to a lower dimensional space.

##### Methods of Dimensionality Reduction

The methods used for dimensionality reduction are

- • Principal Component Analysis (PCA)
- • Linear Discriminant Analysis (LDA)
- • Generalized Discriminant Analysis (GDA)

The importance of dimensionality reduction in ML is to reduce the unwanted features in complex data sets. It is similar to filtering noise in signal and image processing applications. The main drawback of unwanted features is that they are time consuming and require more resources with no effect in the output performance. As an example of dimensionality reduction, in signal processing applications all the inputs are multiplied with corresponding weights and summed together to produce the output. Some of the inputs have zero coefficients and do not produce any change in the output behavior. Removal of zero coefficients represents a reduction in the number of coefficients, which in turn is called dimensionality reduction. The same concept can be applied in ML to reduce the time and area complexity which decides the overall ML system performance.

*10.1.3.2.5 Clustering*

Clustering is grouping similar data points together. Clustering can be divided into two subcategories, hard clustering and soft clustering. Clustering segregates groups with similar qualities and assigns them into clusters. Clustering determines the fundamental grouping among the unlabeled data present. In each group, the members are called agents and these agents are similar w'ith respect to their behavior. For example, consider a basket full of colored balls such as red, green and blue balls all mixed together. The output clusters are three in number and each cluster collects either red balls, green balls or red balls.

*10.1.3.2.5.1 Hard Clustering* In this type of clustering the data point present in

the space should completely belong to a cluster or not. For example, each student is put into 1 group out of 15 groups. Suppose a department in an institution offers membership in NSS, NCC, RSP and Sports club. A very few students (e.g., 10 students) in a class completely belongs to NSS club activities, another group of 10 students in the same class completely participate in NCC activities, another group of 10 students in the class completely participate in RSP activities and the rest of the students actively participate in only Sports club activities.

*10.1.3.2.5.2 Soft Clustering* In this type of clustering, the data point present in the space is assigned to a cluster based on the probability or likelihood of that data point. For example, each student is assigned a probability to be in either of 15 clusters. For example, each student is put into one group out of the 15 groups in a probabilistic manner. Consider the various clubs of institution are NSS, NCC, RSP and Sports club. The probability of students from a class for cluster 1 will be 0.3, i.e., 30% from the total number of students belongs to cluster 1 or NSS Club. Similarly, the probability of students from a class for cluster 2 will be 0.2, i.e., remaining 20% of students belongs to cluster 2 or apart from cluster lor NCC Club. Similarly, the probability of students from a class for cluster 3 will be 0.25, i.e., remaining 25% of students belongs to cluster 3 or apart from cluster 1 and cluster 2 or RSP Club. Similarly, the probability of students from a class for cluster 4 will be 0.25, i.e., the remaining 25% of students belong to cluster 4 or apart from cluster 1, cluster 2 and cluster 3 or Sports Club.

The methods used for clustering are

- • К-means Clustering: In this method, the value of К must be properly chosen for perfect clustering. Some knowledge of mathematics in linear algebra is required to perform this clustering.
- • Hierarchical Clustering: This method is most important in many applications.

#### Reinforcement Learning

Reinforcement learning is a kind of dynamic programming that trains algorithms using feedback from the system. Reinforcement learning algorithms have to take sequential actions or decisions to improve cumulative reward. The best examples of reinforcement learning are: walking practice given by the parents to the child and dictionary formation in typing text messages in all mobile phones. The newly typed words are added as a tag word or label word in the dictionary and can be utilized further. Markov chain and Markov decision processes are examples of reinforcement learning.

The difference between reinforcement learning and supervised learning are:

- • In supervised learning the model is trained with the right answer because the correct answer is available in terms of patterns with the training data.
- • In reinforcement learning there is no correct patterns in the training set, so the reinforcement agent is intended to learn from its previous experience.

**The steps in reinforcement learning involve:**

- • Input
- • Output
- • Training
- • Learning phase
- • Decision phase

There are two types of reinforcement, positive reinforcement and negative reinforcement.

*10.1.3.3.1 Positive Reinforcement*

This type of reinforcement gives the positive effect on performance. It maximizes the strength and frequency of the performance. For example: walking practice given by the parents to the child.

*10.1.3.3.2 Negative Reinforcement*

This type of reinforcement gives the negative effect on performance. For example: remedial classes for weak learners.

### Challenges and Limitations of Machine Learning

The main challenges and limitations of ML is both the deficiency of data and dataset diversity. More mathematical models and equations are to be used to solve the NP-Hard problems with the help of effective ML techniques. Machines cannot learn if there is insufficient data, and a very diverse dataset lengthens the ML time. Machines cannot extract information when the dataset consists of zero or few variations between the data and thus leads to poor prediction. All the input data, training set patterns or features and testing data must be unique. No repeated patterns must be trained and tested. Sometimes unwanted data can be eliminated using suitable dimensionality-reduction methods. Architecture selection and algorithmic simplicity play a major role in ML to produce better performance. The major challenge in pursuing research in the field of ML is to select the suitable optimization input parameters and training patterns or features with help of best heuristic algorithm [3].

#### Applications of ML

Various applications of ML include ^{[1]}

- [1] Spam filtering • Credit card fraud detection • Check digit recognition • Face recognition • Image analysis • Handwriting recognition • Movie recommendation system • Industrial Automation • Object recognition • Signal processing applications • Embedded systems • Crack detection in civil engineering • Medical applications • Surveillance • Noise removal in lathe industries • Noise removal in public