Skip to content
ImagineWorld

AI Problems and Methods

node_idnode-book_artificial-intelligence-for-cybersecurity_chapter-05-ai-problems-and-methods
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num5
chapter_titleAI Problems and Methods
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

In the previous chapters, you learned some basic definitions and taxonomies regarding artificial intelligence. This chapter will help you enhance this foundation and learn about concrete AI methods that are applied in cybersecurity. The knowledge from this chapter will help you get an idea of how different methods work and in what type of problems they are applicable. Furthermore, you will learn the advantages and disadvantages of applying these methods in particular conditions.

We’ll start by looking at the main categories of machine learning methods and describe example methods relevant to this book:

  • Supervised learning methods
  • Unsupervised learning methods
  • Semi-supervised learning methods
  • Anomaly detection

We’ll show some examples of various methods, including those from the supervised machine learning (random forest and neural networks), unsupervised learning (K-means, DBScan, and t-SNE) and semi-supervised learning categories. We’ll also describe anomaly detection and introduce you to convolutional neural networks, deep learning, and generative adversarial networks (GANs), all of which are popular methods at the time of writing. We’ll cover anomaly detection as a separate topic as it can be both supervised and unsupervised, and it often contains distinct methods that are not used in other types of scenarios.

This section describes the concrete supervised learning methods that can be applied in cybersecurity scenarios. We’ll describe where they can be applied, how they work, and what their advantages and disadvantages are. Supervised learning methods are used to solve problems where we have input data (X) and target outputs (Y), which means the training and validation data needs to be labeled with its associated output. In cybersecurity, an example would be data that is labeled as an attack or benign network traffic. The goal is to train the machine learning model so that it can find the pattern that produces the target output.

In other words, we are looking for a mathematical function (f) with a parameter set (W), where Y=f(X, W). For instance, a simple example would be a linear function, Y=WX. Depending on our assumptions, we can use different types of functions, such as linear, polynomial, sine, and so on. During training, the parameters of the function are optimized to produce outputs that are close to the target training outputs.

The following figure illustrates a linear model that’s been fitted to the training inputs and target outputs:

Figure 5.1 – A linear regression model trained based on 2D inputs (blue points)

Figure 5.1 – A linear regression model trained based on 2D inputs (blue points)

In the preceding figure, we’re looking for a model that can find the line that describes the pattern created by the data points.

Multiple types of models can address a supervised learning problem. Depending on the complexity of the patterns, we can apply more complex methods that are more powerful but more computationally demanding and difficult to optimize, or simpler methods that are easier to use but only apply to simple supervised learning problems.

We’ll start by looking at a simple method called logistic regression, which is used for classification problems. These are problems where we have input data to which we want to assign a label from a predefined list. In terms of cybersecurity, this could involve assigning labels for malicious or benign behavior or classifying input data to one of the users for authentication in biometrics.

One of the methods of supervised learning that is often used for classification is logistic regression. In classification problems, we assign discrete labels to data as associated output. For example, when classifying network traffic, we can assign attack data as 1 and benign data as 0. It’s similar to linear regression, which was illustrated in the previous example, except that we assign discrete labels rather than continuous ones.

To adapt the method for classification, we add an additional part to the function that converts the result of the linear function into a value between 0 and 1. This allows us to use it for classification at a later time by thresholding those values and discretizing them to 0 or 1.

We can use the following equation (go to References section and go to [1]) to define the logistic function:

In our case, the parameters, μ and s, are the parameters of the model, and x is the input.

We can also rewrite the expression in the following way:

Here, it’s more obvious that we have a linear function under exponentiation. Given that this function returns a value between 0 and 1 as a result, it’s a good candidate to be used for a binary classification model.

To have an accurate model, we need to find the parameters, and such that provides a value as close as possible to the target labels for every input, x, from the training set. In practice, we create a loss function that’s optimized using a gradient descent procedure. A common loss function that’s used for logistic regression is cross-entropy [1]:

The closer the function values are to the target outputs, the lower the loss function value is. The gradient of this function helps us find the direction of the fastest change of the function toward the optimal value – in our case, the minimum. By iteratively changing the parameters, and, in the direction of the negative gradient, we find the parameters that get the minimal cross-entropy value. This way, we find the function, ), that represents the optimal classifier based on our training set.

Logistic regression can be a very good solution for simple classification problems, but as it’s a simple model, it can struggle with more complex patterns. In the following subsection, we’ll describe random forest, a method that is more robust and can give better results for more difficult classification problems.

Another approach to classification is to base it on decision trees. Decision trees are often used in real life to make decisions by iteratively considering different factors. For instance, when we are deciding whether to go on vacation, we consider our financial status, then available vacation days, weather forecasts, and so on. We can translate this way of thinking into machine learning-based classification, where the classification process is guided by thresholding different values of features. However, the question is how to set the thresholds for feature values for each decision.

Furthermore, we need to consider in which order we consider the feature values when making iterative decisions. Algorithms such as ID3 and CART can help us optimize decision trees so that they can classify data.

The following figure shows an example of a decision tree with two variables, and. The path in the tree and the resulting decision depends on the value of the two variables:

Figure 5.2 – Example of a decision tree with three attributes

Figure 5.2 – Example of a decision tree with three attributes

In practice, one decision tree often doesn’t get us close to the globally optimal solution for classification due to the size of the search space. Therefore, in most cases, in practice, we use a large number of decision trees and combine their results. These decision trees are constructed using a subset of data and a random subset of features. We combine their decisions by averaging in the case of regression and majority voting in the case of classification. Majority voting means that, for the same input, we take the result that most decision trees produce. This approach of combining multiple decision trees is called random forest. The approach of combining different singular classifiers into one is generally called ensemble learning [15] and is often used with other classifiers as well. Ensemble learning often produces superior solutions compared to training one classifier because it makes the model more robust. However, it causes an additional computational burden as we need computational power and time to train a large set of classifiers.

The following figure shows an example of a random forest, where the outputs of multiple decision trees are combined:

Figure 5.3 – Visualization of a random forest – an ensemble of decision trees

Figure 5.3 – Visualization of a random forest – an ensemble of decision trees

Next, we’ll cover SVMs.

Another traditionally popular algorithm for classification is SVM. This approach relies on identifying an ideal separation boundary within the dataset, with the boundary strategically positioned to maximize the distance between points of distinct classes and the boundary itself. This enables good generalization on the test set. We can imagine the classification boundary as a line in the 2D space, and a hyperplane in the n-dimensional space.

The following figure shows the classification boundary that’s defined by training an SVM, together with two classes separated by that boundary. The boundary is set to create the maximum distance between the boundary and the dotted line, which represents the closest points of different classes:

Figure 5.4 – The maximum margin boundary found by an SVM

Figure 5.4 – The maximum margin boundary found by an SVM

The points closest to the boundary are called support vectors and they determine the position of the boundary.

Mathematically, the training process can be defined like so [1]:

In the first expression, the vector, w, represents the margin – that is, the smaller the value of w; this is the larger margin between the classes. The second expression represents the separation between the classes – that is, the target class,, should be the same as the class retrieved by the model.

If the data in different classes is not linearly separable, there is a way to transform it into a different feature space, where they can be separated. This is called a kernel trick. The most used transformation is the Gaussian kernel, where we use the Gaussian radial basis function:

Neural networks can be used in both supervised and unsupervised learning settings, but they are most famous for their use in supervised learning, in particular in classification. This method is inspired by the way biological neural networks behave, where you have multiple constructs (units), and the input is transformed through multiple connected units (neurons) to produce the final result.

The following figure shows a typical neural network architecture. This model architecture is called a multilayer perceptron (MLP):

Figure 5.5 – An MLP network

Figure 5.5 – An MLP network

In an MLP, the inputs are forwarded through multiple layers of parameterized transformation, which in the end produces an output that should comply with the pattern based on the training set. Each connection represented by arrow connectors in the preceding figure is parameterized by weight and a bias parameter. In a typical MLP architecture, the input into a unit (represented by a circle) is multiplied by a weight and processed with an activation function, and a bias is added to this product. This makes it a linear transformation. Furthermore, to account for non-linear dependencies between input and output, we typically use a non-linear activation function.

A common example of an activation function is the sigmoid function, which is used to model nonlinear patterns:

The following plot shows the shape of the sigmoid activation function:

Figure 5.6 – Example plot of a sigmoid function

Figure 5.6 – Example plot of a sigmoid function

From the preceding plot, you can see that lower values of x produce an f(x) close to 0, whereas higher input values produce an output closer to 1. This makes the sigmoid function control the values of the output to be between 0 and 1, and at a value of 0.5 in case the input is 0. If we use this function in the last layer of transformation, the sigmoid function is perfect for binary classification as it can play a role in the decision function. For values over 0.5, the data example is classified as class 1, whereas for output values under 0.5, the data example is classified as belonging to class 0.

Deep learning is a machine learning paradigm that has enjoyed great popularity in the last decade. It is based on the idea that creating a neural network with a large number of layers enables hierarchical learning of a representation of the input data, where each subsequent layer learns increasingly more sophisticated features, such as going from raw pixels to being able to detect objects in an image. This concept is inspired by neuroscience research regarding how the human brain works. However, many deep learning methods are based on empirical knowledge from testing various deep neural network configurations on large-scale datasets. Similar to what we described in the Neural networks section, deep neural networks consist of multiple layers of transformation. In deep learning, the idea is to increase the number of layers and use various types of units and activation functions to allow the layers to be used optimally to produce the right performance.

For instance, in addition to using fully connected layers like in MLP, there are other popular layers such as convolutional layers, which enable convolutional filters to be used in each layer to capture localized patterns. This is based on convolution filters in image processing or speech recognition. Another option is to vary the activation functions. For instance, one popular activation function is the rectifier linear unit (ReLU), which enables better propagation of the gradient during training.

The following figure shows a plot of the ReLU activation function. Notice the constant part for inputs lower than zero and the linear increase for inputs higher than zero:

Figure 5.7 – Example plot of a ReLU activation function

Figure 5.7 – Example plot of a ReLU activation function

It enables us to tackle the well-known problem of vanishing gradients. This is the problem characteristic of deep learning architecture, where the gradients sometimes become too small while being propagated through the neural network and the information for updating the neural network weights is not transmitted properly. This is because the number of updates depends on the size of the gradient. Apart from activation change, we can also create variations in training techniques to improve the solutions we obtain while training the deep neural networks. One such technique is dropout [6]. The idea of dropout is to use only a random subset of units in the network – that is, drop out some of the units – to introduce more variation and reduce the chance of overfitting. This is implemented by activating the units in each training iteration with a certain probability, where a lower probability means that more units will be dropped out.

The following figure shows an example of connections with dropout during MLP training:

Figure 5.8 – The effect of dropout on the neural forward pass during training

Figure 5.8 – The effect of dropout on the neural forward pass during training

After training, in the test period, all the units are activated and we use the weights that were determined during training.

Various types of deep neural networks fit into the deep learning paradigm. One such type is convolutional neural networks.

Convolutional networks are commonly used in contemporary deep learning architectures. They are typically based on alternated use of convolution and pooling layers and have both a biological basis and a basis in previous research – in areas of signal processing that deal with pattern recognition in natural signals such as images, speech, video, and similar.

Convolution layers are based on using a filter matrix that’s applied to different portions of an image using matrix multiplication to detect patterns and transfer the knowledge about them to the subsequent neural network layers. As a difference from feedforward neural networks (such as MLP), in convolutional networks, the layers are not fully connected – that is, not all the units in neighboring layers are connected. Here, we use a transformation matrix (kernel) that has smaller dimensions than the layer size, and we apply this matrix by repeatedly using matrix multiplication in different parts of the network layer. This means that the same parameters are shared in different parts of the network (sparse interaction). This improves the efficiency of the neural network because there are a smaller number of parameters that we need to store and fewer operations to execute during training. Furthermore, the transformations in the convolution layers have translation invariance. This is achieved because the same transformation is applied in different parts of the network. So, independently of where an input pattern appears (for example, an object on an image), this pattern will be detected by the convolution operation:

Figure 5.9 – The convolution filter that’s used in a convolutional neural network

Figure 5.9 – The convolution filter that’s used in a convolutional neural network

In a typical series of layers in the convolutional network, the results of the convolution layer are forwarded to an activation function and then to a pooling layer. The pooling layer reduces the size of the input by applying an aggregation, such as maximum (max-pooling), average (average pooling), or similar. Pooling allows the amount of features to be reduced and helps make the result invariant to small translations in the input.

The following figure shows the architecture of AlexNet, a famous neural network architecture that was used in the ImageNet Large Scale Visual Recognition Challenge competition and produced one of the top results:

Figure 5.10 – Neural network architecture of AlexNet (inspired by https://papers.nips.cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf)

Figure 5.10 – Neural network architecture of AlexNet (inspired by https://papers.nips.cc/paper\_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf)

After AlexNet, there were multiple research efforts to improve the architecture and gain better neural network performance by varying the number of layers and the types of units and connections used in the neural network. The following table explains some of the most famous neural network architectures:

Neural NetworkNumber of ParametersYear of Publication
AlexNet [7]60 million2012
GoogLeNet [8]4 million2014
VGGNet [9]138 million2014
ResNet [10]60.3 million2015
Inception v3 [11]6.4 million2019

Table 5.1 – Some of the most famous neural network architectures

Convolutional networks are typically used in discriminative learning scenarios such as classification. However, increasingly important are the generative models, in particular GANs, where instead of output labels, new data points are generated based on the detected patterns.

A GAN [12] is an example of a neural network that’s used for generative models. It differs from typical MLP and convolutional neural networks, which are discriminative models. Even though generative models are typically unsupervised, due to the configuration of the network, a GAN works more like a supervised model.

Furthermore, a GAN is special in that it consists of two networks: a generator and a discriminator. The idea is that the generator and discriminator are optimized with different criteria, and are conditioned to be mutually adversarial. The goal of the generator is to produce an output that closely resembles the distribution of data from the training set. On the other hand, the goal of the discriminator is to predict whether a data sample comes from the training set or has been generated by the generator part of the network. At the beginning of training, the generator only generates random noise and observes the discriminator’s output. The parameters of the generator and discriminator are gradually adjusted using a gradient descent procedure in an alternating manner to improve their goals. The idea is that the generator needs to improve to fool the gradually better discriminator to generate data that cannot be distinguished by a sophisticated discriminator network. This means that the generated data is very close to the distribution of the training set (p(x)).

This is depicted in the following figure:

Figure 5.11  – High-level GAN architecture

Figure 5.11 – High-level GAN architecture

The goal of training the GAN is to learn the distribution,. We start by defining the prior noise distribution,, and a network architecture that maps the noise to the image,. This function depends on the parameter set,, that gets optimized during training. The discriminator network,, has a distinct architecture, with parameters,, and outputs a probability of an image belonging to the set of real (or fake) images.

Mathematically, the optimization procedure is defined in the following way [12]:

Here, D(x) is the objective function of the discriminator and G(z) is the objective function of the generator. The first part of the function, V, specifies the discriminator’s attempt to successfully differentiate the generated images from the real ones. The second part encodes the objective of the generator to generate images that the discriminator has difficulty classifying. In essence, it is a zero-sum game where two neural networks compete to optimize their objective function.

The equation for training the generator and discriminator is as follows [12]:

The preceding expression contains the gradient update for the discriminator. The parameters of the discriminator are the weights of the discriminator neural network [12]:

In the preceding expression, we define the part of the loss that is included in the update of the generator neural network.

In the next section, we’ll take a deep dive into unsupervised learning methods and describe how to uncover patterns in unlabeled input data.

In unsupervised learning, the task is to train a model that represents the input data, without having the target data available. This section will help you understand the most prominent unsupervised learning methods and give you an idea of when they are useful in cybersecurity scenarios.

Typically, the learned model in unsupervised learning provides a compressed representation of the input data that abstracts away the noise and uncovers the latent structure in the dataset. For instance, in clustering, the input data is represented by the clusters that have been uncovered by the clustering model. The parameters of the model govern the mapping between the input data and the cluster IDs.

The following figure illustrates the underlying structure of input data. In this case, the data can be naturally grouped into three clusters:

Figure 5.12  – Example of clusters in data

Figure 5.12 – Example of clusters in data

In the following subsection, we’ll describe K-means, one of the most well-known unsupervised learning methods.

One of the most commonly used algorithms for clustering is the K-means method. When using this method, the data is partitioned into K clusters, where each cluster is characterized by its central point (mean). Each data point is classified to its nearest mean. The goal is to find a partition where the distance between the points in the same cluster is minimal – that is, where the distance between the points and the mean of their assigned cluster is the smallest possible.

The simplest model training procedure is built on alternating between two steps:

  • Cluster assignment to training points: Each point is assigned to its nearest mean
  • Recalculating the cluster centers: The position of the center for each cluster is computed as the mean for all points in that cluster

The result of applying the K-means method highly depends on the preassigned number of clusters (K). Here, K needs to be known in advance, or it can be optimized by trying out different values of K and observing the result. This can be a disadvantage if it’s difficult to estimate the number of clusters in advance and it’s too time-consuming to run the clustering with multiple values of K. In this case, sometimes, it’s better to use alternative clustering methods. One of these methods is DBSCAN.

DBSCAN is a density-based clustering method. This means that the clusters are detected as areas where there is high density in the data. The advantage is that for this method, you don’t need to provide the number of clusters in advance. However, two hyperparameter values need to be known and that the user needs to enter before training:

  • minPts: The minimum number of points that constitute a region of high density
  • eps: The maximum distance between points in the same region of high density (neighborhood)

Here, we create a neighborhood around each point, recursively expand them, and merge them to create clusters. More specifically, the algorithm consists of the following steps:

  1. Find the core points as a basis for the neighborhoods. The core points are the points where at least minPts points are within eps distance of them.
  2. Expand the neighborhoods by adding points that are less than eps distance from the points already in the neighborhoods. Furthermore, points in the same neighborhoods are in the same cluster.
  3. Points that are not assigned to any neighborhoods (not within eps distance from any point) are considered outliers.

The additional feature of this algorithm is that it can be used for anomaly detection as well since it’s possible to discover outliers in the data that don’t belong to the defined clusters.

The following plot shows an example of the results of DBSCAN on a sample dataset. Here, we can see that the DBSCAN detected the existence of three clusters:

Figure 5.13 – Example of data clusters detected by the DBSCAN method

Figure 5.13 – Example of data clusters detected by the DBSCAN method

t-SNE [13] is an unsupervised algorithm for compressing data that’s often used for visualizing high-dimensional datasets. It’s based on finding a compressed (lower-dimensional) representation of data, where relative distances between data points are preserved. This means that the data points that are similar – that is, with lower pairwise distance in the original data – should also be similar in the compressed representation. To do this, we must use a conditional probability given by the following equation [13]:

We define a similar similarity measure for the lower dimensional representation [13]:

The assumption is that if the t-SNE mapping is correct, the probabilities, and, will be the same (or similar). Therefore, in the t-SNE training algorithm, we gradually adjust the mapping to increase the similarity between the two distributions.

and are the distributions over data points,, and mapped points,, respectively.

The training is done using gradient descent, where we adjust the compressed representation,, to gradually minimize the KL divergence.

Given that we can compress data while keeping the underlying similarity structure, this method can be used to visualize clusters in the data and provide a first impression of what high-density areas exist. However, since the method is stochastic, when the algorithm is run multiple times, the results can look different each time.

The following two figures show three separately generated groups of three-dimensional points initialized with random Gaussians centered at 3, 5, and 10, respectively, with a standard deviation of 1, and their 2D compressed representation generated using t-SNE:

Figure 5.14 – Example of 3D data with three clusters

Figure 5.14 – Example of 3D data with three clusters

The following figure shows a 2D compression of the data with three clusters:

Figure 5.15 – Projecting the 3D data from Figure 14 into 2D using t-SNE

Figure 5.15 – Projecting the 3D data from Figure 14 into 2D using t-SNE

Apart from supervised and unsupervised methods, we have semi-supervised problems. Since they often appear in many areas, including cybersecurity, we’ll take a closer look at them in the following section.

Semi-supervised learning [5] is applied when a dataset consists of both labeled and unlabeled data. This is often because labeling data is expensive or difficult to obtain. Therefore, part of the data is unlabeled. However, we still want to take this data into account by using a method that generates outputs according to the target labels, but also conforms to the latent structure patterns that are discovered via unlabeled data.

Semi-supervised learning methods are usually a combination of supervised and unsupervised learning strategies and enable a more accurate model than the ones that are obtained using only labeled or unlabeled data. For this combination to provide added value compared to using only labeled data and purely supervised training, some assumptions (to an extent equivalent) about data need to hold:

  • Smoothness assumption: If points and have similar values, their corresponding target values, and, need to be similar
  • Low-density separation: The decision boundary should lie in a low-density region
  • Manifold assumption: The data lies in a low-dimensional manifold

These assumptions show that the data needs to have an underlying structure that can be exploited by performing unsupervised learning on unlabeled data, to cause the semi-supervised model to provide more accurate results.

In the next subsection, we’ll describe label propagation, one of the most well-known instances of semi-supervised learning methods.

A subgroup example of semi-supervised learning methods that is often used and available in popular machine learning libraries is label propagation. The idea of label propagation methods is to propagate labels from labeled examples to unlabeled ones using similarity to infer labels for the unlabeled data. This way, we can classify the unlabeled points with the labels that were previously associated with similar points. This is based on the previously named smoothness assumption. For this, we need a matrix (W) that contains a similarity measure between each pair of data points ().

The following algorithm describes the training process for label propagation:

  1. Compute the affinity matrix, W.
  2. Compute the diagonal matrix, D, where we have the following [5]:
  3. Initialize.
  4. Iterate until convergence:
  5. Label point with the sign of.

This means that we iteratively assign labels to the unlabeled examples until they satisfy our smoothness assumption optimally. There are multiple more sophisticated versions of this algorithm, but they all have a similar basis.

In the next section, we’ll cover various anomaly detection methods. These methods are useful for finding outlier points or patterns in data.

As described in the previous chapter, anomaly detection methods are used to detect outliers, novelty, and anomalies in datasets that don’t conform to the dominant patterns in the data. To do this, in general, we need to detect the dominant pattern during training. This can be done both supervised and unsupervised, depending on whether we have labeled data. Therefore, anomaly detection methods are often extensions of conventional supervised or unsupervised learning methods. In the case of supervised learning, multiple variants of anomaly detection methods are based on supervised classification models:

  • Methods where anomalies belong to the minority class: Here, we can use conventional supervised learning methods, with additional methods being used to tackle the problem with unbalanced data, for example by undersampling the majority class or oversampling the minority class.
  • Methods where anomalies don’t conform to existing classes present in the training labels: Here, we can detect anomalies by observing the output of the classifier, where the class probabilities don’t show a high enough value for available classes. Another option is to use a loss function that allows points that are outside the pattern of current classes in the training set to be detected.

The following figure illustrates a dataset with anomalies compared to the dominant high-density regions:

Figure 5.16 – Anomalies in data that have been detected using anomaly detection

Figure 5.16 – Anomalies in data that have been detected using anomaly detection

In the following subsection, we’ll describe isolation forest, one of the most used instances of anomaly detection methods.

An example of an unsupervised anomaly detection method is isolation forest [17]. This method can be understood as a variant of the previously described random forest method, although random forest is a supervised method.

The idea is to split the data points using a binary tree iteratively by one-by-one attribute. In each iteration, the split is done by an attribute, q, and a random split value, p, and they are split into two subtrees, q<p and q≥p. We do this procedure on random subsets of data and create multiple such trees. In the test phase, we run each point through the constructed tree. The expectation is that, for anomalous points, it takes fewer splits to isolate a point on average compared to normal points. The anomaly score in isolation forest is based on this number of splits:

Figure 5.17 – Running a normal point and an anomaly through a tree via isolation forest

Figure 5.17 – Running a normal point and an anomaly through a tree via isolation forest

In the next subsection, we’ll cover another anomaly detection method known as one-class SVM. This method is a variant of SVM that’s used to encircle the points that belong to the majority pattern and detect outliers outside of that pattern.

One-class SVM can be understood as a variant of SVM that’s used for anomaly detection scenarios. In this case, we only have one class of normal data, and we are trying to separate this normal data from outliers by a large margin. The normal data is limited by a hypersphere with a specific center (c) and radius (r). During training, the optimization is directed to finding the smallest hypersphere that contains most of the data points. Therefore, it should contain all the normal points, and only anomalies will stay outside of the hypersphere.

This can be encoded in the following mathematical expressions for constrained optimization [14]:

In the first expression, the radius (r) is minimized, whereas the second expression contains the constraint that most of the data needs to satisfy to be within the hypersphere of that radius. The value,, determines the proportion of outliers that are accepted in the training set, whereas the constant,, is there to allow outliers to be outside of the hypersphere.

The following plot contains an example of the hypersphere defined by training a one-class SVM, with the regular observations within the sphere and outliers outside of it:

Figure 5.18 – A dataset with a trained anomaly detection boundary when using one-class SVM

Figure 5.18 – A dataset with a trained anomaly detection boundary when using one-class SVM

Now that we’ve covered the various methods that will be specified in this book, let’s summarize this chapter.

In this chapter, we described various unsupervised learning, supervised learning, semi-supervised learning, and anomaly detection problems and presented concrete methods that are used for them. You need to understand these concrete methods and the problems that they address to be able to understand when and how to apply them. Even though we rarely implement these methods from scratch, knowing how these methods work will enable you to save time and cost when applying the wrong tools to the job. Furthermore, it will enable you to gain a better understanding of the results you’ll see when applying these methods and help you explain them to your project stakeholders.

In the next chapter, you will learn where these methods fit into an artificial intelligence project, how the workflow works, and how to get optimal results by using the available tools.

  • [1] Murphy, Kevin P. Machine learning: a probabilistic perspective. MIT press, 2012.
  • [2] James, Gareth, Daniela Witten, Trevor Hastie, and Robert Tibshirani. An introduction to statistical learning. Vol. 112. New York: springer, 2013.
  • [3] Chandola, Varun, Arindam Banerjee, and Vipin Kumar. “Anomaly detection: A survey.” ACM computing surveys (CSUR) 41, no. 3 (2009): 1-58.
  • [4] Aggarwal, Charu C., and Charu C. Aggarwal. An introduction to outlier analysis. Springer International Publishing, 2017.
  • [5] Learning, Semi-Supervised. “Semi-supervised learning.” CSZ2006. html 5 (2006): 2.
  • [6] Bengio, Yoshua, Ian Goodfellow, and Aaron Courville. Deep learning. Vol. 1. Cambridge, MA, USA: MIT press, 2017.
  • [7] Krizhevsky, Alex, Ilya Sutskever, and Geoffrey E. Hinton. “Imagenet classification with deep convolutional neural networks.” Advances in neural information processing systems 25 (2012).
  • [8] Szegedy, Christian, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. “Going deeper with convolutions.” In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1-9. 2015.
  • [9] Simonyan, Karen, and Andrew Zisserman. ” Very deep convolutional networks for large-scale image recognition.” arXiv preprint arXiv:1409.1556 (2014).
  • [10] He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. ” Deep residual learning for image recognition.” In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. 2016.
  • [11] Szegedy, Christian, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. ” Rethinking the inception architecture for computer vision.” In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818-2826. 2016.
  • [12] Goodfellow, Ian, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. ” Generative adversarial networks.” Communications of the ACM 63, no. 11 (2020): 139-144.
  • [13] Van der Maaten, Laurens, and Geoffrey Hinton. ” Visualizing data using t-SNE.” Journal of machine learning research 9, no. 11 (2008).
  • [14] Schölkopf, Bernhard, Robert C. Williamson, Alex Smola, John Shawe-Taylor, and John Platt. ” Support vector method for novelty detection.” Advances in neural information processing systems 12 (1999).
  • [15] Kuncheva, Ludmila I. Combining pattern classifiers: methods and algorithms. John Wiley & Sons, 2014. Scikit-learn
  • [16] Pedregosa, Fabian, Gaël Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier Grisel, Mathieu Blondel et al. ” Scikit-learn: Machine learning in Python.” the Journal of machine Learning research 12 (2011): 2825-2830.
  • [17] Liu, Fei Tony, Kai Ming Ting, and Zhi-Hua Zhou. ” Isolation forest.” In 2008 Eighth IEEE international conference on data mining, pp. 413-422. IEEE, 2008.