CS代考 1. Introduction and JUnit

1. Introduction and JUnit

Module 1 Part 1 of 2
Introduction and Agents

1

1

Class Learning Objectives
Understand objectives of AI
Apply agents
2

The word “AI” has become ubiquitous. But what, exactly, does it mean? This part answers that question. A good portion of AI approaches problems from the perspective of agents—autonomous objects like you and me. We may react to circumstances but what we do is up to each of us.
2

Agenda: Introduction and Agents

3
Introduction
AI Topics
Agents

In this section, we will explain the history of two great currents in AI: logic and learning from data.

Brief History
Early
Symbolic processing
Capture human knowledge
Identify mathematical principles
Standalone

4

The early history of AI was driven by attempts to capture and apply “intelligence.” Much effort was expended on identifying what intelligence actually was. It was thought to be largely our ability to reason. An example is the way we prove theorems. When you try to automate this, you find yourself processing symbols, such as the system knows a = b and it also knows b = c, so it should be able to infer a = c. Symbolic processing is still very much with us; in fact, there has been a blossoming of “SAT solvers” which are quite capable of reasoning.

In the case of specialized fields such as the maintenance of sophisticated radars, there is a kind of shortcut to symbolic reasoning. It consists of transferring the specialized knowledge of experts to computers. These are called expert systems.

An approach championed by Carthy and others was to identify basic principles of intelligence—hopefully not a large number of them. An example is the closed world assumption: that an assertion not provable by what’s known to the system can be assumed false. This is not a practical approach as of this writing.

Early AI (i.e., pre-Internet) systems suffered from lack of contact with the world outside themselves, and this influenced their design.
4

Early Example: Blocks World
5

Source: Russel & Norvig

The Blocks World, consisting of real or simulated blocks of various shapes, was often used as a demonstration environment for early reasoning systems. For example: you can’t place a block on one with a pointed top. Blocks World is a useful playground in which to develop planning algorithms.
5

Midway on: Neuron
6

Source: Russel & Norvig

Many animals have neurons, the main constituents of human brains. These are cells that accept electro-chemical input from other neurons (via dendrites), process these inputs (in the soma), and send output to other neurons. The gaps between connected neurons are called synapses, and their strengths reflects the state of the brain. Artificial neural nets simulate this process.
6

Brief History
Early
Symbolic processing
Capture human knowledge
Identify mathematical principles
Standalone
Midway
Neural nets
Fuzzy logic
Reinforcement learning
Contemporary…

7

The field of neural nets has its origin with McCulloch and Pitts in 1943 but was not considered part of AI until the 21st century. Neural nets use the idea of brain neurons to fit functions to data sets. When Hinton et al showed in 2012 that deep learning could be effective, the field expanded rapidly into areas—such as natural language—than had been considered the purview of classical AI.
7

Brief History
Early
Symbolic processing
Capture human knowledge
Identify mathematical principles
Standalone
Midway
Neural nets
Fuzzy logic
Contemporary
Deep neural nets
Big data
Small data
Adversarial

8

There is no “last word” on AI: discoveries are being made which could turn the tables once more. Approaches that seemed to have passed their heyday, such as fuzzy logic, could well surpass the best known current approaches. For example, humans do not seem to learn via massive amounts of data, as neural nets do. We appear to need only a few examples. Does this matter? We don’t know. The fact that airplanes do not flap their wings as birds do has not prevented their success.

8

Agenda: Introduction and Agents

9
Introduction
AI Topics
Agents

In this section, we will review the main topics of the course. Besides providing a setting, it will help in pointing you to a term project topic.

Topics
Searching for Solutions
Define problem; perform (efficient) search; heuristics
Constraint Satisfaction
Solve problem by “boxing in”
Reasoning in First-Order Logic
“Intelligence” involves reasoning, which applies logic
Planning
Knowledge Representation
Uncertainty
Machine Learning
Reinforcement Learning
Natural Language
10

From the earliest days, AI has often been thought of a searching for solutions. We will cover those basics, including the A* algorithm. Another classical way to arrive at solutions is to do this in the context of constraints—limits imposed on solutions. First order logic refers to the simplest kind of reasoning, which we will certainly discuss.
10

Topics
Searching for Solutions
Define problem; perform (efficient) search; heuristics
Constraint Satisfaction
Solve problem by “boxing in”
Reasoning in First-Order Logic
“Intelligence” involves reasoning, which applies logic
Planning
Knowledge Representation
Uncertainty
Machine Learning
Reinforcement Learning
Natural Language
11

https://slideplayer.com/slide/2353639/8/images/17/A%2A+search+example.jpg

A common example of searching for a solution is to find a route from one city to another. A central idea in AI is heuristics—a way of proceeding that may not be bound to known mathematics but which arises from experience and from similarity with other problems.
11

Topics
Searching for Solutions
Define problem; perform (efficient) search; heuristics
Constraint Satisfaction
Solve problem by successively “boxing in”
Reasoning in First-Order Logic
“Intelligence” involves reasoning, which applies logic
Planning
Knowledge Representation
Uncertainty
Machine Learning
Reinforcement Learning
Natural Language
12

http://slideplayer.com/slide/8968662/27/images/1/Constraint+Satisfaction+Problems+%28Chapter+6%29.jpg

Every problem context has constraints—conditions that the solution has to conform to. These limit what can and can not be solutions. For example, if we want to find values for x and y, we can consider a required relationship as a constraint: for example, x + y = 3. When there are many strong constraints, the solution may be entirely determined, such as y – x = 1 (in addition). Constraints do not necessarily determine a unique solution but many AI problems do not have a (single) unique solution. The second constraint could have been y – x  1, for example.

Sudoku, and chess piece placement, can be thought of as constraint satisfaction problems.
12

Topics
13

https://image.slidesharecdn.com/c10logic1-121109070410-phpapp02/95/propositional-and-firstorder-logic-10-638.jpg?cb=1352445053
Searching for Solutions
Constraint Satisfaction
Reasoning in First-Order Logic
“Intelligence” involves reasoning, which applies logic

It is natural to think of logical reasoning as an important element of intelligence. In this example, we show (“prove” is a better term) that
[p  (p  q)] implies q (1)
regardless of what predicates p and q stand for. (For example “p” may stand for “there is a rabbit on Fifth Avenue.”) We can see that if we know a fact (“p”), and we know that it always implies (results in) another fact q, then this is enough to conclude that q is true. We’d call that obvious but an AI system may not know this up front, whereas, it may know various more fundamental rules, and so it would have to conclude (1) from those rules. The illustration indicates the steps that the AI system would need to go through to establish it. We will return to first order logic later.
13

Searching for Solutions
Constraint Satisfaction
Reasoning in First-Order Logic
Planning
Generate steps to fulfill a goal (execution separate)
Knowledge Representation
Practical coding (“data structures”)
Uncertainty
To mirror the real world
Machine Learning
Reinforcement Learning
Natural Language
Topics ctd.
14

http://www.cs.colostate.edu/~cs540/spr2018/res_images/cs540logo.gif

Planning is another classical AI area. We will explore it in depth during the course. The figure illustrates the problem of devising a plan to get to the block configuration in the lower right from the initial configuration at upper left. Planning is a lot like programming.

The first issue that most AI applications have to deal with is how to represent the relevant artifacts. In the planning example, we need to define the data structure that species the beginning and ending block configurations, as well as those in between.
14

Topics ctd.
Searching for Solutions
Constraint Satisfaction
Reasoning in First-Order Logic
Planning
Knowledge Representation
Uncertainty
Machine Learning
Will review selected aspects (otherwise CS 767)
Reinforcement Learning
Something beneficial found => hard code tendency
Natural Language
Intertwined with our thinking
15

Machine learning has always been part of AI: in fact, a debate has raged for years as to whether any system can be considered “intelligent” is it does not learn. Neural nets have become the dominant way to do this. CS 767 is devoted entirely to machine learning. In this course, we will discuss the basics but we will also discuss techniques not covered in CS 767.
15

Searching for Solutions
Constraint Satisfaction
Reasoning in First-Order Logic
Planning
Knowledge Representation
Uncertainty
Machine Learning
Will review basics (otherwise CS 767)
Reinforcement Learning
Something beneficial found => code tendency
Natural Language
Intertwined with our thinking
16

https://www.google.com/url?sa=i&source=images&cd=&cad=rja&uact=8&ved=2ahUKEwju_dzN09TfAhWJmuAKHda8AusQjRx6BAgBEAU&url=https%3A%2F%2Fsimple.wikipedia.org%2Fwiki%2FReinforcement_learning&psig=AOvVaw0RB2zNeLfQwDVzhrUZHgLR&ust=1546709315132377

In particular, we will cover reinforcement learning, in which an agent interacts with the world around it, and learns from this by reinforcing beneficial actions and suppressing destructive ones. We will discuss agents in this part of Module 1.

Natural language processing (NLP) has also been a part of AI for many years, and has progressed steadily. It was though to be distinct from neural net methods but in recent years, neural net approaches have accelerated the effectiveness of NLP. We will discuss NLP in a separate unit.
16

Agenda: Introduction and Agents

17
Introduction
Topics
Agents

“Intelligence” is often thought of as something that a being possesses. Beings behave within their environment in a kind of autonomous fashion—as opposed to being externally controlled. That’s the idea of an agent.

Agents: Definition and Example
18
A software entity
with autonomy
that causes actions.

Examples:
Automated adversary in a video game
Intelligent tutor

Wumpus World (R&N)
19

Russell and Norvig developed a simple environment in which to illustrate AI principles based on agents. They call this Wumpus World (p 210) because it contains a troublesome “wumpus,” of interest to the agent (shown with bow). Wumpus World enables demonstrations of reasoning—here, in the presence of stenches near the wumpus, and breezes near pits that trap the hunter agent, in a search for gold. Since a breeze delivers a stench, the agent is able to reason about what to do before experiencing the consequences of a decision.
19

Simplest Agent Example (R&N):
Vacuum World
20

An even simpler example is Vacuum World. The agent is an intelligent vacuum that lives in spaces A and B. This is its environment. In general, an agent interacts with an environment that’s external to it.

20

Agents: Architecture
21

Source: Russel & Norvig

A percept is a fact about the environment that an agent is capable of detecting. In the case of Vacuum World, there are four percepts, as shown. Agents are capable of detecting some, but not necessarily all percepts, and that’s what makes this interesting.
21

Agents: Architecture
22

Source: Russel & Norvig

Return to later

Agents are capable of actions that may affect the environment. There are three, as shown, in the case of Vacuum World.
22

Applying Rules
23

Source: Russel & Norvig

A basic loop for an agent trying to fulfill a goal is …
Make an observation (a percept)
Add this percept to my existing sequence of percepts
Select an action from the condition-action rules
Perform the action

23

Example of Select an action

24

http://www.geog.leeds.ac.uk/courses/other/crime/abm/example/index.html
Source: Russel & Norvig

The algorithm for selecting an action is thus at the heart of every agent design. An example, still at a high level, is shown in the figure. In this case, action selection depends on the degree of the potential burglar’s need, emotion, and act of will at the time.
24

PerceptAction for Vacuum World
25

Source: Russel & Norvig

In the case of Vacuum World, a table suffices. In principle, even this is infinite: this illustrates the need in AI applications to impose reasonable limits.
25

Example Application:
Modeling Burglary Occurrences
26

http://www.geog.leeds.ac.uk/courses/other/crime/abm/example/index.html
“Bounded rationality”: rationality is limited, when individuals make decisions, by
tractability of the decision problem
cognitive limitations of the mind
time available to make the decision

https://en.wikipedia.org/wiki/Bounded_rationality#:~:text=Bounded%20rationality%20is%20the%20idea,available%20to%20make%20the%20decision.

Burglar Agents
27

http://www.geog.leeds.ac.uk/courses/other/crime/abm/example/index.html

The reference shows the resulting activities of several burglar agents.
27

MESA: A Python Agent API
28
https://mesa.readthedocs.io/en/master/

Schelling video of segregation model: https://www.youtube.com/watch?v=dnffIS2EJ30
from mesa import Agent, Model
class MoneyAgent(Agent): “””An agent with fixed initial wealth.”””
def __init__(self, unique_id, model):
super().__init__(unique_id, model)
self.wealth = 1

class MoneyModel(Model): “””A model with some number of agents.””“
def __init__(self, N):
self.num_agents = N # Create agents
for i in (self.num_agents): a = MoneyAgent(i, self)

MESA is a package that enables agent implementation. The example shows a MoneyAgent class—which inherits from MESA’s Agent class, and a model. A model is an environment in which agents exist, taking actions in the manner we have described.
28

Summary
Search for Solutions
Satisfy Constraints
Use reasoning (typically First-Order Logic)
Plan
Represent Knowledge
Handle uncertainty
Have Machines Learn (e.g., Reinforcement L.)
Handle Natural Language
Agent concept suits many situations
29

The summary in the figure lists the topics mentioned in this introduction. We will also discuss approaches to uncertainty, especially fuzzy logic.
29

/docProps/thumbnail.jpeg