Hands-On Convolutional Neural Networks with TensorFlow
上QQ阅读APP看书,第一时间看更新

AI and ML

For the purpose of this book, consider artificial intelligence (AI) as the field of computer science responsible for making agents (software/robots) that act to solve a specific problem. In this case, "intelligent" means that the agent is flexible and it perceives its environment through sensors and will take actions that maximize its chances to succeed at some particular goal.

We want an AI to maximize something that is named Expected Utility or the probability of getting some sort of satisfaction by doing an action. An easy to understand example of this is by going to school, you will maximize your expected utility of getting a job.

AI aspires to replace the error-prone human intelligence involved in completing tedious everyday tasks. Some central components of human intelligence that AI aims to mimic (and an intelligent agent should have) are:

  • Natural Language Processing (NLP): Give the ability to understand spoken or written human language and give natural response to questions. Some example NLP tasks include automated narration, machine translation, or text summarization.
  • Knowledge and Reasoning: Develop and maintain an updated knowledge of the world around the agent. Follow human reasoning and decision-making to solve specific problems and react to changes in its environment.
  • Planning and problem solving: Making predictions about possible actions and choosing the one that maximizes some expected utility, in other words, choosing the best action for that situation.
  • Perception: The sensors that the agent is equipped with provides it with information about the world that the agent lives in. The sensors could be something as simple as an infrared sensor or more complicated such as a microphone for speech recognition or a camera to enable machine vision.
  • Learning: For the agent to develop knowledge of the world, it must use perception to learn through observation. Learning is a way of knowledge acquisition that will be used to reason and make decisions. The subfield of AI that deals with algorithms that learn from data without some explicit programming is named Machine Learning.

ML uses tools such as statistical analysis, probabilistic models, decision trees, and neural networks to process efficiently large amounts of data instead of humans.

As an example, let's consider the following problem of gesture recognition. In this example, we want our machine to identify what hand gesture is being shown. The inputs to the system are hand images, as shown in the following image, and the output is the digits that they represent. The system that would solve this problem needs to use perception in the form of vision.

Giving just raw images as input to our machine would not produce a reasonable result. Therefore, the images should be preprocessed to extract some kind of interpretable abstraction. In our particular case, the simplest approach would be to segment the hand based on color and make a vertical projection summing the non-zero values on the x-axis. If the width of the image is 100 pixels, then the vertical projection forms a vector 100-elements long (100-dimensional), with the highest values at the location of the unfolded fingers. We can call any vector of features, that we extract, a feature vector.

Let’s say that for our hand data, we have 1000 different images and we have now processed them to extract feature vectors for each. In the machine learning stage, all the feature vectors will be given to a machine learning system that creates a model. We hope that this model can generalize and is able to predict the digit for any future images given to the system that it wasn’t trained on.

An integral part of an ML system is evaluation. When we evaluate our model, we see how well our model has done in a particular task. In our example, we would look at how accurately it can predict the digit from the image. Accuracy of 90% would mean that 90 out of 100 given images were correctly predicted. In the chapters that follow, we will discuss in more detail the machine training and evaluation process.