Beginning Artificial Intelligence with the Raspberry Pi-Apress(2017).pdf
文件大小: 11890k
源码售价: 10 个金币 积分规则     积分充值
资源说明:Artificial intelligence, or AI, is an exciting field and my purpose in writing this book is to convey some of that excitement to you. I will be using the Raspberry Pi single-board computer as the primary tool through which you can explore how AI works and, consequently, gain additional insight on how you might incorporate AI into your projects and/or applications. I do want to make something perfectly clear at the outset: reading this book and completing all the projects will not make you an expert in AI. This is analogous to the situation where a layperson taking a first aid course could never claim to be a medical doctor or a nurse after taking that course. Becoming an AI expert requires that you take many college courses—both undergraduate and graduate—in a variety of areas, including mathematics, computer science, logic, and even philosophy. There are also AI experts who come from other spheres of interest, including music and the allied arts. Having made the previous statements, I do want you to understand that gaining a reasonable introduction to AI is very achievable by reading this book and other readily available resources. It is just that you should not try to claim that you are an AI expert after reading this book. I will next discuss why the Raspberry Pi is a good platform with which to examine AI. You should first note that it is a very capable computer on its own merit. Why certainly not as fast nor as memory capable as a modern PC or Mac, it is no slouch, especially when using a Raspberry Pi 3. This model has a clock speed of 1 GHz, uses four cores, and has 1 GB of dynamic ram. This is quite impressive when you realize that this performance comes with a price tag of only $35 (USD). However, the key feature that makes the Raspberry Pi so attractive for AI demonstrations is that it is a microcontroller. This means you can directly control things based upon the outcome of AI events. Microcontrollers also allow sensors to be easily connected to them, thus allowing AI applications a means to interact with the real world. While PCs can also be set up to both sense and control, it often requires expensive and complex interfaces to achieve these capabilities. The Raspberry Pi was initially designed to be able to sense and control devices with minimal interface requirements, and perhaps more importantly, minimal software requirements. PC software interfaces are often very complex, expensive, and typically proprietary—meaning making user changes or modifications is a difficult-to-impossible task. The Raspberry Pis that I use in this book use a Raspian Linux distribution named Jessie. This distribution is completely open source and freely available from the Raspberry Pi Foundation’s download website. It is a very stable operating system (OS) and supports several extremely large open-source applications repositories. This means that all the software used in this book is freely available and easily downloadable into the Raspberry Pi. xix ■ PrefaCe I use a variety of languages and applications in the book’s various demonstrations and projects. The languages used are mainly Python, Prolog, and the Wolfram Language. Each of these languages brings some unique features that allow the book demonstrations to be quickly and easily implemented. The main application that I use is Mathematica, which is a full-featured symbolic processing program that also happens to be part of the Jessie distribution. Mathematica is also a commercial program that ordinarily costs hundreds of dollars, but is provided gratis due to the very generous gift of the Wolfram Corporation and Dr. Stephen Wolfram (CEO) in particular. I tried to layout the book in a logical manner by first introducing AI in Chapter 1. It is difficult to explain AI to people who have never heard of it, although it is often surprising to inform that them that AI often affects them in their daily lives. I have provided a considerable amount of detail in the first chapter by trying to define AI and how it is commonly applied in everyday life situations. It will soon become apparent to you how invasive AI has become in modern society, whether you like it or not. Please note that I used the term invasive in a non-derogatory way, simply to point out that AI is commonly applied in many areas, some of which will surprise you. In addition, I also discuss the topic of business intelligence (BI), as it is very closely allied to AI and is often the vehicle through which AI affects most people. Some AI practitioners often refer to BI as simply AI applied in a business setting. You will learn that it is much more than that, however. I adopt it because it is a useful simplification. I next explore some basic AI concepts in Chapter 2. There is initially some discussion regarding basic logical constructs, as they are important to understand inference, which is an AI core foundation. Expert knowledge systems are next discussed, which constitute a major portion of the more general knowledge management systems (KMS)—an important part of BI. The discussion then turns to machine learning, which is a huge research area in modern AI. Finally, I conclude the chapter with an introduction to fuzzy logic (FL), which is thoroughly demonstrated in a later book project. Chapter 3 shows you how to implement a practical expert system using the Prolog language. I explore some key Prolog features and explain how this somewhat specialized language is so useful in implementing AI concepts, without requiring extensive programing support as would be necessary if general-purpose languages such as C/C++ or Java were used for the same purposes. A simple console question-and-answer program is used in the practical demonstration. Chapter 4 focuses on using AI with games. Admittedly, the games are quite simple; however, the chapter’s goal is to simply demonstrate how AI is incorporated into gaming logic. These gaming AI concepts may then be easily expanded to handle much more complex games. I used Python to implement the games, which are controlled through a traditional text-console interface. Do not expect to see World of Warcraft (WoW)–quality graphics in this chapter, but rest assured that WoW does use AI in its games. In Chapter 5, I return to using Prolog to implement some fuzzy logic controls for a practical project demonstration. There is also a simplified expert rules system incorporated into the project. A Raspberry Pi system using both temperature and humidity sensors will control a virtual heating and cooling system. Chapter 6 introduces the concept of shallow machine learning. A Python program is created, in which the computer “learns” your favorite color and make “decisions” regarding color selection. Finally, I close the chapter with a discussion of adaptive learning, which plays a large role in BI. xx Chapter 7 continues the machine learning topic with an examination of machine learning using artificial neural networks (ANN). ANNs are by far the most prevalent AI method used to implement machine learning. I go through a detailed discussion on how an ANN is constructed, and then demonstrate an actual neural network created with Python. The machine learning continues into Chapter 8, where deep learning is discussed. In this chapter’s project I go through a detailed discussion on how a multi-layer ANN functions incuding the gradient search feature. Chapter 9 contains two demonstrations of deep learning using multi-layer ANNs. The first one recognizes hand-wriiten numbers based on the MNIST training and test dataset. The second one uses a Pi Camera with a Raspberry Pi to image a hand-written number and then uses the previously trained ANN to determine the closest match. Chapter 10 deals with evolutionary computing (EC), which encompasses, but is not limited to, evolutionary programming, genetic algorithms and genetic programming. I have provided several interesting demonstrations highlighting some of the EC features to provide you with a good introduction to this fascinating field. Chapter 11 discusses subsumption, which is a behavior-based robotic study area. It is closely allied with AI. I use the robot car first introduced in Chapter 7 to conduct several demonstrations. You will quickly realize that a robot employing subsumption behaviors can remarkably mimic actual human behavior, thus completing the AI loop between human thinking and motor behavior. I am quite confident that after reading through this book and duplicating most—if not all the projects and demonstrations, you will come away with an excellent appreciation of AI and how to incorporate it into your future projects.
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。