Pure Mathematics for Theoretical Computer Science

A View Through Artificial Intelligence and Its Relationships with Machine Learning and Deep Learning

Sandy Montajab Hazzouri
Volume 2, Issue 1, pp. 08-17 (2023)
DOI: https://doi.org/10.54216/PMTCS.020101
Online: https://www.americaspg.com/journal/40/article/2132

Abstract

This paper presents a comparison between artificial intelligence, machine learning and deep learning. From artificial intelligence and its types of systems, through machine learning and its stages to deep learning, the most important features that belong to each of them are identified, illustrated by simple examples that help to understand the difference.

Keywords: AI; machine learning; deep learning; expert systems

1. Introduction

The field of technology has been continuously developing for many years and still is. Over time, the world has become its own different fields, dealing with terms such as artificial intelligence, machine learning and deep learning. On

Despite the use of these terms, there are misconceptions about what these words mean. In fact very often they are confused and with respect to the meaning of these terms and their definitions that seem similar, but for each term the definition is different from the other.

Figure 1. The relationship between artificial intelligence, machine learning and deep learning
Figure 1. The relationship between artificial intelligence, machine learning and deep learning

2. Artificial Intelligence

The birth of the field of artificial intelligence AI Was in the summer of 1956, at a conference held at Dartmouth University, and these conference participants have become pioneers in artificial intelligence research for several years. Herbert, Allen Newell Marvin, John McCarthy(MIT), Simon (CMU) Minsky (MIT) and Arthur Samuel (IBM) were the first to create an artificial intelligence laboratory at MIT and CMU, Standford, and together with their students wrote many important programs in this field .

Defense Advanced Research-DARPA Projects Agency, a research and Development Agency of the US Department of Defense, responsible for the development of emerging technologies for use by the military in the mid-sixties, funded this research, and for a significant part of those attempts were unsuccessful. At the beginning of the Eighties interest in this field returned with commercial success

In 1985, the marketing of AI programs reached an estimated one billion dollars. In the nineties was the Golden Age of artificial intelligence, where it achieved great successes and was adopted in wide areas and harnessed in industry technologies

These successes are due to many factors, including the amazing power of computers, great interest in solving partial problems related to a particular field, creating new links between AIAND other fields working on similar problems, in addition, researchers undertook mathematical methods and accurate scientific metrics

3. Expert systems

Expert systems are one of the first forms of artificial intelligence systems, as they are built on automated inference engines, based on the "If" condition to be the result of the system based on ."Then" AI applications can be divided into two types, in terms of results depending on the rule .If-Then the first is classification and discrimination applications, and the second is control applications and doing certain commands, in any case, the controllers classify the conditions before deducing events and commands, and classification is the basic part in most artificial intelligence systems

Work on Expert Systems began in the late fifties, and the result was the design of programs that can solve complex problems, the solution of which is considered intelligent behavior, if it is done by humans. In the Sixties, artificial intelligence scientists tried to simulate the complex process of human thinking by finding methods to solve a large-scale problem .although some notable progress was achieved, this strategy did not lead to any outstanding results. designing systems with general goals was very difficult, so the focus was instead on designing more specific and specific systems

During the seventies the attention of scientists was captured by the techniques of how to represent the problem, the search for a successful solution that saves memory and time, and again this strategy did not yield any outstanding progress or success. In the late seventies, artificial intelligence scientists came to the conclusion that the strength and intelligence of the program in solving problems comes first from the knowledge it contains, and not just from the mechanism of representation, research and inference that it uses, and this led to great success in accessing intelligent systems, by providing it with a quantity of knowledge in a specific and specialized field. And this area of artificial intelligence began to spread and develop very quickly in most areas of working life

Artificial intelligence, which formed one of the new Sciences during the Eighties, can be said to be the science that is interested in creating software and physical components capable of simulating human behavior. The biggest challenge is to emulate the human being in the cognitive processes that he performs without education or thinking, such as looking, Hearing, Speech and movement in a balanced way

Definition of artificial intelligence .

Many researchers in this field have defined artificial intelligence, "artificial intelligence is the science capable of building machines that perform tasks that require some amount of human intelligence when performed by a human being "Kurzweil 1991, as in figures2 . "Artificial intelligence is the study of computational methods that make it possible to perceive, reason and influence Winston 1992 "

Figure 2. a machine that performs tasks that need human intelligence
Figure 2. a machine that performs tasks that need human intelligence

The study of how to direct a computer to perform things performed by a human being in a better way, rich and Knight 1991 artificial intelligence is an exciting effort to make machines think, to have a mind in the truest sense of the word "

. John Haugeland 1985 "artificial intelligence is concerned with intelligent behavior when manufacturing" Nilsson 1998

Artificial intelligence systems .

Artificial intelligence successfully solves problems that are characterized by the absence of a clear algorithm for solving them, or require high intuition, enormous calculations. From it, artificial intelligence systems were classified as in Figure 3from four types, two of which are related to thinking and the other is related to behavior, namely systems that think logically, systems that think like a human, systems that affect logically, systems that affect like a human

* Systems that think logically: these systems adopt the theory of logic and inference to build solutions based on

On the terminology of logic. But not every intelligent behavior is necessarily the result of logical thinking, in addition, it is difficult to formulate logical formulas for all knowledge .

* Systems that think like a human being: thinking like a human being is of interest to cognitive science, that is, to define an exact theory

For brain work. But if we want to say that a system thinks like a human being, we must first determine how a human being thinks, and from this enter the mechanism of the functioning of the human brain. This is extremely difficult, because to this day science has not been able to come up with a mechanism for how and the mechanism of human thinking .

* Systems that affect humans: one of the most famous of these systems is the Turing test, developed by The Scientist Alan

Turin in 1950. Where an isolated person writes a question, and behind the wall there is a machine and a human being who have to answer, and the questioner has to find out whether the respondent is a machine or a human, as in Figure 4 .

Figure 3. Turing Test
Figure 3. Turing Test

It was predicted that in 2000the probability that a machine will deceive a human in its behavior for 5 minutes will be 30 percent, and this has been achieved in many systems

* Systems that affect logically: the logical behavior may be the result of a logical analysis, or it may be a response

An act that does not require much thought. It is from him that the implementation of a correct procedure means that the procedure is chosen that makes the process of reaching the goal ideal taking into account the available information, hence the concept of a smart client .

4. Machine Learning

Machine learning is an important part of artificial intelligence, and it is one of its branches that is concerned with making the computer able to learn on its own from previous experiences and experiences, making it able to predict and make the right decision faster. The term machine learning was first used in 1959 by Arthur Samuel, an American pioneer in the field of artificial intelligence and computer games, he worked at the International Business Machines Corporation(IBM) in the sixties, where he described machine learning as "the ability to learn without explicit programming"

Artificial intelligence can be obtained without the use of machine learning, but this requires the construction of millions of lines of code segments with complex rules. So instead of making programs that contain specific information to accomplish a certain task, machine learning is a way to train an algorithm so that it can learn. Training involves feeding the algorithm large amounts of data, allowing it to adjust its transformations and optimize its results. One of its most important methods is the use of artificial neural networks, as in Figure 5they resemble the mechanism of action of vital neurons in the human brain

Figure

. Figure 4: artificial neural network

A neural network consists of a group of nerve cells (neurons) interconnected with each other, where a vital neuron is defined as a simple processing unit that has several inputs called elongations and an output called an axis. The Axon at its end branches into thousands of branches, each of which affects other neurons of the synapse.

Similarly, an artificial neuron has been defined in a way that simulates a biological neuron, where each neuron receives a signal from neighboring neurons and after performing mathematical operations in the cell nucleus, the output of the cell is an input to other neighboring neurons, as in Figure 5

Figure 5. bio-neuron and artificial neuron
Figure 5. bio-neuron and artificial neuron

Machine learning can lead to the achievement of a variety of automated applications, and in various fields such as weather forecasting, face recognition, disease diagnosis, and others.. Machine learning requires a lot of complex mathematics, especially from derivation operations, and also many traditional algorithms include cluster and classification algorithms that are not new, some of which date back to the Sixties, such as the naïve Bayes Classifier and Support Vector Machines, In addition to data dimensionality reduction algorithms such as principal component analysis TSNE

The results obtained from the designed model can be compared with the real ones in reality, adjusting the mutants to reduce the error value the next time. So that the difference between the desired goal and the model output becomes as small as possible, from which it can be said that machine learning seeks to build algorithms capable of reducing the error in classification and prediction and from which it is able to learn

: Practical application A.

Let's illustrate this with an example as in fig.7, by using machine learning to make radical improvements in the field of computer vision. To begin with, the data, where thousands of images containing an object are collected, is determined on

For example, a cat, and another photo contains a dog. To come an important stage in the construction of the classification model, namely image processing and extraction of characteristic qualities, in our example this will be each pixel in the image

It is an input to the neural network that resembles the neural networks in the human brain. After the training phase is over, the model can classify the images and give a result as to whether the image contains a cat or a dog. When the classification accuracy becomes high enough, it can be said that the machine has "learned" how to distinguish images with a cat from images with a dog, even if it was given new images for the first time that were not used at the training stage .

Figure 6. classification of an image containing a cat using machine learning
Figure 6. classification of an image containing a cat using machine learning

The following is the Python code section for building and training a neural network consisting of four layers and an input layer, where the number of input neurons is 3600, the number of neurons of the first hidden layer is 20 neurons, the second hidden layer is 7 neurons, the third hidden layer is 5 neurons and the output layer is a single neuron. The training set consists of 11,500 photos of a cat, 11,500 photos of a dog, and the activation sequences were linear, relue, linear, sigmoid .

import pickle import numpy as np from dnn_app_utils import * %load_ext autoreload %autoreload 2 np.random.seed(1) train_x_orig = pickle.load(open('X.pkl', 'rb')) train_y = pickle.load(open('y.pkl', 'rb')) train_y = train_y.reshape(1, len(train_y)) classes = ['Cat', 'Dog'] # Explore the dataset m_train = train_x_orig.shape[0] num_px = train_x_orig.shape[1] print ("Number of training examples: " + str(m_train)) print ("Each image is of size: (" + str(num_px) + ", " + str(num_px) + ", 3)") print ("train_x_orig shape: " + str(train_x_orig.shape)) print ("train_y shape: " + str(train_y.shape)) # Reshape the training examples train_x_flatten = train_x_orig.reshape(train_x_orig.shape[0], -1).T # Standardize data to have feature values between 0 and 1. train_x = train_x_flatten / 255. print ("train_x's shape: " + str(train_x.shape)) layers_dims = [3600, 20, 7, 5, 1] # 5-layer model # GRADED FUNCTION: n_layer_model def L_layer_model(X, Y, layers_dims, learning_rate=0.075, num_ iterations=3000, print_cost=False): #lr was 0.009 np.random.seed(1) costs = [] # Parameters initialization. parameters = initialize_parameters_deep(layers_dims) # Loop (gradient descent) for i in range(0, num_iterations): # Forward propagation: [LINEAR -> RELU]*(L-1) –> LINEAR -> SIGMOID. AL, caches = L_model_forward(X, parameters) # Compute cost. cost = compute_cost(AL, Y) # Backward propagation. grads = L_model_backward(AL, Y, caches) # Update parameters.

parameters = update_parameters(parameters, grads, learning_rate) # Print the cost every 100 training example if print_cost and i % 100 == 0: print ("Cost after iteration %i: %f" % (i, cost)) if print_cost and i % 100 == 0: costs.append(cost) # plot the cost plt.plot(np.squeeze(costs)) plt.ylabel('cost') plt.xlabel('iterations (per tens)') plt.title("Learning rate =" + str(learning_rate)) plt.show() return parameters # Run the training parameters = L_layer_model(train_x, train_y, layers_dims,learning_rate = 0.1, num_iterations=100, print_cost=True) ## compute accuracy pred_train = predict(train_x, train_y, parameters) ## write the parameters to csv file as result. file = 'fifth.csv' with open(file, 'w') as csv_file: writer = csv.writer(csv_file) for key, value in parameters.items(): writer.writerow([key, value])

After the training, the following table of results was obtained:

Table 1. The results of neural network training
Figure 7. training results after 10,000 repetitions and a learning coefficient of 0.1
Figure 7. training results after 10,000 repetitions and a learning coefficient of 0.1

5. Deep LEARNING .

Deep learning is one of the most important subfields of machine learning, the term "deep learning" was used by Rina Dechter in 1986this science is based on deep artificial neural networks, which require a large amount of data in the learning and problem solving process Deep learning is inspired by the structure and functions of the brain, as it mimics the biological structure of the brain. In deep neural networks, there are neurons arranged in separate layers and connections with other neurons. Each layer is responsible for a property to learn, such as curves, edges and others in the classification of images. It is these layers that give deep learning its name, "depth" arises from the use of multitasking layers instead of link layers .

Deep artificial neural networks have unique capabilities that enable deep learning models to solve tasks that machine learning models cannot solve. All recent advances in intelligence are due to deep learning without which we would not have self-driving cars, chatbots or an intelligent personal virtual assistant, as in Figure 8like Alexa and Siri

Figure 8. siri smart virtual assistant
Figure 8. siri smart virtual assistant

In fact, deep learning includes a subset of machine learning systems, which make up the operating capabilities that machines have. This technique is similar to a machine learning system in some contexts, but the difference is that machine learning needs some actions performed by the programmer to perform the task, while deep learning can perform the task without the intervention of the programmer. When dealing with a machine learning system, the programmer should adjust the algorithm if the results are inappropriate, but for deep learning models, they take care of it themselves, just like the human mind .

Practical application.

Let's return to the example of classifying photos that contain a cat or a dog. When using machine learning after image processing and extracting characteristic qualities, a neural network-like model is built in the human brain, which after training can accurately classify images. But with deep learning, as in figure9, the image is used directly without performing any series of operations, as an input to the deep neural network. After a series of training operations, the network is ready to give the appropriate output

Figure 9. classification of an image containing a cat using deep learning
Figure 9. classification of an image containing a cat using deep learning

The following is the Python code for building and training a cnn deep neural network. The next program passage for image processing is at the training stage import numpy as np import os import cv2 import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') DIRECTORY = r'C:\Users\balajiam\Documents\ML Data Analysis\Cats-Vs-Dog' CATEGORIES = ['cat', 'dog'] data = [] for category in CATEGORIES: path = os.path.join(DIRECTORY, category) for img in os.listdir(path): img_path = os.path.join(path, img) label = CATEGORIES.index(category) arr = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE) new_arr = cv2.resize(arr, (60, 60)) data.append([new_arr, label]) import random random.shuffle(data) X = [] y = [] for features, label in data: X.append(features) y.append(label) X = np.array(X) y = np.array(y) import pickle pickle.dump(X, open('X.pkl', 'wb')) pickle.dump(y, open('y.pkl', 'wb'))

The following software clip for training the deep neural network has achieved an accuracy of 0.8936:

import pickle X = pickle.load(open('X.pkl', 'rb')) y = pickle.load(open('y.pkl', 'rb')) X = X/255 X = X.reshape(-1, 60, 60, 1) from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, Dense, Flatten model = Sequential() model.add(Conv2D(64, (3,3), activation = 'relu')) model.add(MaxPooling2D((2,2))) model.add(Conv2D(64, (3,3), activation = 'relu')) model.add(MaxPooling2D((2,2))) model.add(Flatten()) model.add(Dense(128, input_shape = X.shape[1:], activation = 'relu')) model.add(Dense(2, activation = 'softmax')) model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) model.fit(X, y, epochs=5, validation_split=0.1)

The next program passage is to predict that an image is a cat or a dog .

import cv2 from tensorflow import keras import numpy as np CATEGORIES = ['Cat', 'dog'] def image(path): img = cv2.imread(path, cv2.IMREAD_GRAYSCALE) new_arr = cv2.resize(img, (60, 60)) new_arr = np.array(new_arr) new_arr = new_arr.reshape(-1, 60, 60, 1) return new_arr model = keras.models.load_model('3x3x64-catvsdog.model') prediction = model.predict([image('test_dog.jpg')]) print(CATEGORIES[prediction.argmax()])

6. Conclusion

Machine learning and deep learning are concepts related to artificial intelligence, but they must be distinguished when using them, and the difference can be clearly summarized by another example, "determining whether an image contains a car or not," as in Fig.9 .

When using machine learning we first need to process the image and determine the distinctive and unique qualities of the car from the shape, size, windows and wheels... And extracted, to form input data for the classification model which is a multilayer neural network. While in deep learning it is enough to have the image as an input to the deep neural network, to get the desired result after a number of training times.

Figure 10. classification of an image containing a car using machine learning and deep learning
Figure 10. classification of an image containing a car using machine learning and deep learning

Machine learning and deep learning have led to huge leaps in the field of artificial intelligence in recent years, and the two systems have contributed to expanding the horizons of artificial intelligence in the future. Machine learning and deep learning require huge amounts of data, which can be collected through billions of sensors connected via the internet. On the other hand, machine learning requires stages to extract features with the intervention of the programmer, while deep learning was able to dispense with and deal directly with images through deep neural networks.

Finally, it can be said that the relationship of artificial intelligence, machine learning and deep learning is a containment relationship, in terms of the time of its appearance and related concepts, as in Fig.11

References

  1. . Oswald Campesato, Artificial Intelligence Machine Learning and Deep Learning, MERCURY LEARNING AND INFORMATION, Dulles, Virginia Boston, Massachusetts, New Delhi, 2020. [2]. Stuart J. Russell and Peter Norvig, Artificial Intelligence A Modern Approach, 3nd ed., Upper Saddle River, New Jersey, 2010. [3]. Wolfgang Ertel, Introduction to Artificial Intelligence, University of Applied Sciences, Weingarten, Germany: Springer-Verlag, 2011. [4]. M. Tim Jones, Artificial Intelligence A Systems Approach, INFINITY SCIENCE PRESS LLC, Hingham, Massachusetts, New Delhi,2008. [5]. Ben Coppin, Artificial Intelligence Illuminated, 1st ed, Jones and Bartlett Publishers,2004. [6]. Rudolph Russell, machine learning, step-by-step guide to implement machine learning algorithms with python, 2018