1. Trang chủ
  2. » Công Nghệ Thông Tin

Artificial Intelligence AI report báo cáo cuối kì

68 102 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Báo cáo môn Trí tuệ nhân tạo cuối kì về khái niệm, kĩ thuật, ứng dụng của AI. Viết những khái niệm chung của môn học AI, giúp hiểu những thuật toán xoay quanh chủ đề này. Từ đó, hình thành tư duy lập trình trong AI, có kiến thức sâu rộng trong lĩnh vực này.

HCMC UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH-QUALITY TRAINING Lecturer: Ph.D Nguyen Nhat Quang ARTIFICIAL INTELLIGENCE REPORT ARTIFICIAL INTELLIGENCE GROUP 01 HCMC December 27, 2020 Last update: December 29, 2020 | STUDENT LIST NAME Role Chau Kim Toa Member Mai Ho An Thuy Phan Ngoc Bao Tuyen Member EMAIL 18110056@student.hcmute.ed u.vn 18110052@student.hcmute.ed u.vn Member pnbaotuyen0304@gmail.com STUDENT’ S ID 18110056 18110052 18110062 PREFACE | The present report is the outcome of our team’s works To meet the requirements “Work in groups of students each, write a report and demo the algorithm learned.”, we have tried to watch lecture videos, read documentations on the https://quang-tran-ute.mn.co/ to understand and it Hope this report would illustrate our effort as well as knowledge in working as a team and solving problem Now that nothing is entirely perfect, this report might have some mistakes, and we would appreciate all the evaluation and feedback Since the invention of computers or machines, their capability to perform various tasks went on growing exponentially Humans have developed the power of computer systems in terms of their diverse working domains, their increasing speed, and reducing size with respect to time A branch of Computer Science named Artificial Intelligence pursues creating the computers or machines as intelligent as human beings CHAPTER 01 Artificial Intelligence What is Artificial Intelligence? According to the father of Artificial Intelligence John McCarthy, it is “The science and engineering of making intelligent machines, especially intelligent computer programs” Artificial Intelligence is a way of making a computer, a computer-controlled robot, or a software think intelligently, in the similar manner the intelligent humans think AI is accomplished by studying how human brain thinks, and how humans learn, decide, and work while trying to solve a problem, and then using the outcomes of this study as a basis of developing intelligent software and systems 3 2.| Philosophy of AI While exploiting the power of the computer systems, the curiosity of human, lead him to wonder, “Can a machine think and behave like humans ?” Thus, the development of AI started with the intention of creating similar intelligence in machines that we find and regard high in humans Goals of AI · 3.1 To Create Expert Systems: The systems which exhibit intelligent behavior, learn, demonstrate, explain, and advice its users · 3.2 To Implement Human Intelligence in Machines: Creating systems that understand, think, learn, and behave like humans What Contributes to AI? Artificial intelligence is a science and technology based on disciplines such as Computer Science, Biology, Psychology, Linguistics, Mathematics, and Engineering A major thrust of AI is in the development of computer functions associated with human intelligence, such as reasoning, learning, and problem solving Out of the following areas, one or multiple areas can contribute to build an intelligent system 4 | Programming Without and With AI What is AI Technique? In the real world, the knowledge has some unwelcomed properties:    Its volume is huge, next to unimaginable It is not well-organized or well-formatted It keeps changing constantly AI Technique is a manner to organize and use the knowledge efficiently in such a way that:    It should be perceivable by the people who provide it It should be easily modifiable to correct errors It should be useful in many situations though it is incomplete or inaccurate AI techniques elevate the speed of execution of the complex program it is equipped with 5 7.| Applications of AI AI has been dominant in various fields such as: o Gaming AI plays crucial role in strategic games such as chess, poker, tic-tac-toe, etc., where machine can think of large number of possible positions based on heuristic knowledge o Natural Language Processing It is possible to interact with the computer that understands natural language spoken by humans o Expert Systems There are some applications which integrate machine, software, and special information to impart reasoning and advising They provide explanation and advice to the users o Vision Systems These systems understand, interpret, and comprehend visual input on the computer For example: • • • • • o A spying aeroplane takes photographs which are used to figure out spatial information or map of the areas Doctors use clinical expert system to diagnose the patient Police use computer software that can recognize the face of criminal with the stored portrait made by forensic artist Speech Recognition Some intelligent systems are capable of hearing and comprehending the language in terms of sentences and their meanings while a human talks to it It can handle different accents, slang words, noise in the background, change in human’s noise due to cold, etc 6 | o Handwriting Recognition The handwriting recognition software reads the text written on paper by a pen or on screen by a stylus It can recognize the shapes of the letters and convert it into editable text o Intelligent Robots Robots are able to perform the tasks given by a human They have sensors to detect physical data from the real world such as light, heat, temperature, movement, sound, bump, and pressure They have efficient processors, multiple sensors and huge memory, to exhibit intelligence In addition, they are capable of learning from their mistakes and they can adapt to the new environment 7 8.| History of AI: 8 | What is Intelligence? The ability of a system to calculate, reason, perceive relationships and analogies, learn from experience, store and retrieve information from memory, solve problems, comprehend complex ideas, use natural language fluently, classify, generalize, and adapt new situations 9 | 10.INTELLIGENT AGENTS A rational agent is one that does the right thing Obviously, this is better than doing the wrong thing, but what does it mean? As a first approximation, we will say that the right action is the one that will cause the agent to be most successful That leaves us with the problem of deciding how and when to evaluate the agent's success In summary, what is rational at any given time depends on four things: • The performance measure that defines degree of success • Everything that the agent has perceived so far We will call this complete perceptual history the percept sequence • What the agent knows about the environment • The actions that the agent can perform Agent Terminology · Performance Measure of Agent − It is the criteria, which determines how successful an agent is · Behavior of Agent − It is the action that agent performs after any given sequence of percepts · Percept − It is agent’s perceptual inputs at a given instance · Percept Sequence − It is the history of all that an agent has perceived till date · Agent Function − It is a map from the precept sequence to an action 11.Rationality Rationality is nothing but status of being reasonable, sensible, and having good sense of judgment Rationality is concerned with expected actions and results depending upon what the agent has perceived Performing actions with the aim of obtaining useful information is an important part of rationality 10 10 - Safely explorable state space: the space having no dead-end state | Online depth-first search agent: An online search agent uses depth-first exploration The agent is applicable only in state spaces in which every action can be “undone” by some other action This agent stores its map in a table, RESULT[s, a], that records the state resulting from executing action a in states.Whenever an action from the current state has not been explored, the agent tries that action The difficulty comes when the agent has tried all the actions in a state In offline depth-first search, the state is simply dropped from the queue; in an online search, the agent has to backtrack physically In depth-first search, this means going back to the state from which the agent most recently entered the current state Because of its method of backtracking, ONLINE-DFS-AGENT works only in state spaces where the actions are reversible There are slightly more complex algorithms that work in general state spaces, but no such algorithm has a bounded competitive ratio Why depth-first? In online search: the agent actually walks in the environment 54 54 In| depth-first search: the agent only moves to its next position (with one or a few actions) The implementation of Depth First Search (DFS): Start by putting any one of the graph's vertices on top of a stack Take the top item of the stack and add it to the visited list Create a list of that vertex's adjacent nodes Add the ones which aren't in the visited list to the top of the stack Keep repeating steps and until the stack is empty The purpose of DFS is to visit every node of a graph and collect some sort of information about how that node was discovered Like BFS, DFS can be used on both undirected and directed graphs There are some of its applications: finding connected components, topological sorting, finding 2-(edge or vertex)-connected components, 3-(edge or vertex)connected components, finding the bridges of a graph, generating words in order to plot the limit set of a group, finding strongly connected components, planarity testing Solving puzzles with only one solution, such as mazes (DFS can be adapted to find all solutions to a maze by only including nodes on the current path in the visited set.) Maze generation may use a randomized depth-first search Online A* search: LRTA* (Learning Real-Time A*) algorithm At each step, from state s, agent moves to the successor s’ which has the best estimated cost: Learning Real-Time A* agent A* Search algorithm is one of the best and popular techniques used in path-finding and graph traversals A* Search algorithms, unlike other traversal techniques, it has “brains” What it means is that it is really a smart algorithm which separates it from the other conventional algorithms This algorithm uses the full path cost as the heuristic, the cost to the starting node plus the estimated cost to the goal node A* is an informed algorithm as it uses an heuristic to guide the search The algorithm starts from an initial start node, expands neighbors and updates the full path cost of each neighbor It selects the neighbor with the lowest cost and continues until it finds a goal node, this can be implemented with a priority queue or by sorting the list of open nodes in ascending order It is important to select a good heuristic to make A* fast in searches, a good heuristic should be close to the actual cost but should not be higher than the actual cost Learning Real-Time A* agent selects an action according to the values of neighboring states, which are updated as the agent moves about the state space 55 55 | Constraint Satisfaction Problems are mathematical questions defined as a set of objects whose state must satisfy a number of constraints or limitations CSPs represent the entities in a problem as a homogeneous collection of finite constraints over variables, which is solved by constraint satisfaction methods CSPs are the subject of intense research in both artificial intelligence and operations research, since the regularity in their formulation provides a common basis to analyze and solve problems of many seemingly unrelated families Previous algorithms use atomic state representation, which is one in which each state is treated as a black box Now, we move to factored representation, which is one in which the states are defined by a set of features Defining a CSP with three components: X: a set of variables {X1,…,Xn} D: a set of domains {D1,…,Dn}, one domain per variable C: a set of constraints that specify allowable assignments of values to variables Use a factored representation (a set of variables, each of which has a value) for each state, a problem that is solved when each variable has a value that satisfies all the constraints on the variable is called a CSP A solution of a CSP: values for all variables 56 56 Examples of problems that can be modeled as a constraint satisfaction problem | include: Type inference Eight queens puzzle Sudoku, Crosswords, Futoshiki, Kakuro (Cross Sums), Numbrix, Hidato and many other logic puzzles A map coloring problem: We are given a map, i.e a planar graph, and we are told to color it using three colors, green, red, and blue, so that no two neighboring countries have the same color Advantage of formulating a problem as a CSP: CSPs yield a natural representation for a wide variety of problems; CSP solvers can be faster than state-space searchers because the CSP solver can quickly eliminate large swatches of the search space; 3) With CSP, once we find out that a partial assignment is not a solution, we can immediately discard further refinements of the partial assignment 4) We can see why an assignment is not a solution—which variables violate a constraint Solve CSPs using Constraint Propagation CSPs can be solved using searching on state space but CSP solvers (e.g., constraint propagation methods) can be faster than state-space searchers because Constraint propagation Constraint propagation is the process of communicating the domain reduction of a decision variable to all of the constraints that are stated over this variable This process can result in more domain reductions These domain reductions, in turn, are communicated to the appropriate constraints This process continues until no more variable domains can be reduced or when a domain becomes empty and a failure occurs An empty domain during the initial constraint propagation means that the model has no solution Constraint propagation works by reducing domains of variables, strengthening constraints, or creating new ones Using the constraints to reduce the domain (legal values) for a variable, which in turn can reduce the legal values for another variable, and so on General effects of Constraint Propagation Methods: Reduce the domain of one or more variables Reduce the number of satisfying assignments for one or more constraints Add new (implied) constraints Local consistency: the key idea of constraint propagation A local consistency for a CSP is one that places necessary conditions on either the domain values or constraint assignments for belonging to a solution to the CSP We 57 57 say that a CSP possesses the property when the values of each domain and / or | assignments of each constraint satisfy the conditions Every local consistency condition can be enforced by a transformation that changes the problem without changing its solutions Such a transformation is called constraint propagation If we treat each variable as a node in a graph and each binary constraint as an arc, then the process of enforcing local consistency in each part of the graph causes inconsistent values to be eliminated throughout the graph Types of local consistency: Node consistency: A single variable (a node in the CSP network) is node-consistent if all the values in the variable’s domain satisfy the variable’s unary constraint We say that a network is node-consistent if every variable in the network is nodeconsistent Arc consistency: A variable in a CSP is arc-consistent if every value in its domain satisfies the variable’s binary constraints Xi is arc-consistent with respect to another variable Xj if for every value in the current domain Di there is some value in the domain Dj that satisfies the binary constraint on the arc (Xi, Xj) A network is arc-consistent if every variable is arc-consistent with every other variable Arc consistency tightens down the domains (unary constraint) using the arcs (binary constraints) Constraint graph: A constraint graph is a special case of a factor graph, which allows for the existence of free variables The nodes of a constraint graph are variables while its arcs are constraints The nodes of the graph correspond to variables of the problem, and a link connects to any two variables that participate in a constraint AC-3 algorithm AC-3 maintains a queue of arcs which initially contains all the arcs in the CSP AC-3 then pops off an arbitrary arc (Xi, Xj) from the queue and makes Xi arcconsistent with respect to Xj If this leaves Di unchanged, just moves on to the next arc; But if this revises Di, then add to the queue all arcs (Xk, Xi) where Xk is a neighbor of Xi If Di is revised down to nothing, then the whole CSP has no consistent solution, return failure; Otherwise, keep checking, trying to remove values from the domains of variables until no more arcs are in the queue 58 58 The |result is an arc-consistent CSP that has the same solutions as the original one but has smaller domains Sudoku problem No digit appears twice in any row, column, or × box A Sudoku puzzle can be considered a CSP with 81 variables, one for each square We use the variable names A1 through A9 for the top row (left to right), down to I1 through I9 for the bottom row The empty squares have the domain {1, 2, 3, 4, 5, 6, 7, 8, 9} and the pre-filled squares have a domain consisting of a single value There are 27 different Alldiff constraints: one for each row, column, and box of squares Week 10: Path consistency Arc consistency can help reduce the domains of variables However, sometimes its tasks have no effect A two-variable set {Xi, Xj} is path-consistent wrt variable Xm if, for every assignment {Xi = a, Xj = b} consistent with the constraints on {Xi, Xj}, there is an assignment to Xm that satisfies the constraints on {Xi, Xm} and {Xm, Xj} Path consistency tightens the binary constraints by using implicit constraints that are inferred by looking at triples of variables PC-2 algorithm can enforce path consistency It is very similar to AC-3 algorithm K-consistency: A general form of local consistency A CSP is k-consistent if, for any set of k − variables and for any consistent assignment to those variables, a consistent value can always be assigned to any kth variable Some special cases: 1-consistency = node consistency 2-consistency = arc consistency 3-consistency = path consistency Global constraints A global constraint is one involving an arbitrary number of variables (but not necessarily all variables) Global constraints can be handled by special-purpose algorithms that are more efficient than general-purpose methods Sudoku puzzle as a CSP Variables: X = { X0, X1, …X80} = {A1, B2,…} Domains: D = {D0,…D80} D1= {1,2,…9} Constraints: Alldiff (A1, A2,…, A9) Alldiff (A1, B1,…, I1) Alldiff (A1, A2, A3, B1, B2, B3, C1, C2, C3) Solving a Sudoku puzzle 59 59 Approach 1: AC-3 algorithm | Directly reducing domains of variables using the constraints Approach 2: Triplets In an unit, find squares Remove these numbers from domains of other variables in the unit The mentioned approaches can apply to any CSPs, not just Sudoku Solve CSPs using Backtracking Search Motivation: Sudoku problems can be solved by inference over constraints (constraints propagation) such as AC3, Triplet But many other CSPs cannot be solved by inference alone We could apply depth-first search: + State: current assignment (52 variables) + Action: assign to value Backtracking search, a form of depth-first search, is commonly used for solving CSPs Inference can be interwoven with search Backtracking search: A depth-first search that chooses values for one variable at a time and backtracks when a variable has no legal values left to assign Backtracking algorithm repeatedly chooses an unassigned variable, and then tries all values in the domain of that variable in turn, trying to find a solution If an inconsistency is detected, then backtrack returns failure, causing the previous call to try another value There is no need to supply Backtracking Search with a domain-specific initial state, action function, transition model, or goal test Backtracking Search keeps only a single representation of a state and alters that representation rather than creating a new ones 60 60 | Week 11: Solve CSPs using Local Search: Idea: Consider the space of complete assignments of values to variables (all possible worlds) – Neighbours of a current node are similar variable assignments – Move from one node to another according to a function that scores how good each assignment is A local search consists of a: CSP: a set of variables, domains for these variables and constraints on their joint values A node in the search space will be a complete assignment to all of the variables Neighbour relation: an edge in the search space will exist when the neighbour relation holds between a pair of nodes Scoring function: h(n) judges cost of a node (want to minimize) - The number of constraints violated in node n - The cost of a state in an optimization context 61 61 Example: Sudoku as a local search problem | CSP: usual Sudoku CSP One variable per cell; domains {1, ,9} Constraints: each number occurs once per row, per column, and per 3x3 box Neighbour relation: value of a single cell differs Scoring function: number of constraint violations Min-conflicts algorithm - The initial state may be chosen randomly or by a greedy assignment process that chooses a minimal-conflict value for each variable in turn - The Conflicts function counts the number of constraints violated by a particular value, given the rest of the current assignment 62 62 There | are two steps for solution using min-conflicts for an 8-queens problem At each state, a queen is chosen for reassignment in its column The number of conflicts (in this case, the number of attacking queen) is shown in each square The algorithm moves the queen to the min-conflicts square, breaking ties randomly Min-conflicts are surprisingly effective for many CSPs It solves even the millionqueens problem It has been used to schedule observations for the Hubble Space Telescope, reducing the time taken to schedule a week of observations from from three weeks to around 10 minutes Solve CSPs using Constraint Graphs: Constraint graph is a special case of a factor graph, which allows for the existence of free variables The nodes of the graph are variables and the arcs are constraints Tree-structured CSP: A CSP has a constraint graph which is a tree can be solved in linear time root Main steps to solve a tree-structured CSP: Pick a variable to be the topological root Sort variables such that each variable appears after its parent Enforce arc consistency on sorted variables Choose values for variables from consistent domains Topological root (a) The constraint graph of a tree-structured CSP (b) A linear ordering of the variables consistent with the tree with A as the root This is known as a topological sort of the variables Tree CSP solver: 63 63 | The Tree-CSP-Solver algorithm is used to solve tree-structured CSPs If the CSP has a solution, we will find it in linear time, if not, we will detect a contradiction Tree CSP solver is effective, but what if we don’t have trees To turn a graph into a tree, we remove nodes Removing nodes to turn a graph into a tree: Choose a subset S of the CSP’s variables such that the constraint graph becomes a tree after removal of S S is called a cycle cutset For each possible assignment to the variables in S that satisfies all constraints on S, (a) Remove from the domains of the remaining variables any values that are inconsistent with the assignment for S, and (b) If the remaining CSP has a solution, return it together with the assignment for S Reinforcement Learning: Artificial Intelligence (AI) appeared around 1950 AI is a wide-ranging branch of computer science concerned with building smart machines capable of performing tasks that typically require human intelligence Machine Learning : an application of AI that provides systems the ability to automatically learn and improve from experience without being explicitly programmed 64 64 Supervised learning (Deep Learning) the machine learning task of learning a | function that maps an input to an output based on example input-output pairs Unsupervised learning: a machine learning technique, where you not need to supervise the model Reinforcement Learning: an area of machine learning concerned with how software agents ought to take actions in an environment in order to maximize the notion of cumulative reward Reinforcement learning is one of three basic machine learning paradigms, alongside supervised learning and unsupervised learning Week 12: Cross-entropy method Cross-entropy is commonly used in machine learning as a loss function Its method is a versatile heuristic tool for solving difficult estimation and optimization problems, based on Kullback–Leibler (or cross-entropy) minimization Cross-entropy is a model-free, policy-based and on-policy: It doesn't build any model of the environment It just says to the agent what to at every step It approximates the policy of the agent It requires fresh data obtained from the environment The core of the cross-entropy method is to throw away bad episodes and train on better ones So, the steps of the method are as follows: Play N number of episodes using our current model and environment Calculate the total reward for every episode and decide on a reward boundary Usually, we use some percentile of all rewards, such as 50th or 70th 65 65 Throw away all episodes with a reward below the boundary | Train on the remaining “elite” episodes using observations as the input and issued actions as the desired output Repeat from step until we become satisfied with the result With the preceding procedure, our NN learns how to repeat actions, which leads to a larger reward, constantly moving the boundary higher and higher Despite the simplicity of this method, it works well in basic environments, it's easy to implement, and it's quite robust to hyperparameters changing, which makes it an ideal baseline method to try Limitations of this method: For training, our episodes have to be finite and, preferably, short The total reward for the episodes should have enough variability to separate good episodes from bad ones There is no intermediate indication about whether the agent has succeeded or failed 66 66 | Task Distribution IV This chapter illustrate the tasks for each member on 10 weeks Task Taken by % Done Result 100% Sample documentation with solution and demonstration Document a Phan Ngọc Search and combination Bảo Tuyền documents week compose 100% Sample documentation with solution and demonstration Document a Châu combination Tỏa week Kim Search and documents compose 100% Sample documentation with solution and demonstration Document a Mai Hồ An Search and combination Thúy documents week 10 11 12 13 compose 100% Sample documentation with solution and demonstration Demo Algorithm Châu Tỏa Requirement/purpos e Kim Solve Algorithm Write and Phan Ngọc Write the report with 100% Edit report Bảo Tuyền decoration and suitable edition Final report Edit Word Mai Hồ An Make the report more 80% errors Thúy complete related to fonts, lines in the report file Final report BIBLIOGRAPHY While implementing this project, we have referenced some documentation and get inspired of some website on the Internet https://quang-tran-ute.mn.co/posts/link-tai-li%E1%BB%87u-bai-t%E1%BA %ADp-cac-mon-h%E1%BB%8Dc https://data-flair.training/blogs/history-of-artificial-intelligence/ https://voer.edu.vn/m/cac-he-thong-thong-minh-lai-va-cac-agent-thongminh/cf185151 67 67 4.| 68 https://www.cnblogs.com/RDaneelOlivaw/p/8072603.html https://www.cs.ubc.ca/~mack/CS322/lectures/3-CSP5.pdf 68 ... machines as intelligent as human beings CHAPTER 01 Artificial Intelligence What is Artificial Intelligence? According to the father of Artificial Intelligence John McCarthy, it is “The science and... users · 3.2 To Implement Human Intelligence in Machines: Creating systems that understand, think, learn, and behave like humans What Contributes to AI? Artificial intelligence is a science and... inaccurate AI techniques elevate the speed of execution of the complex program it is equipped with 5 7.| Applications of AI AI has been dominant in various fields such as: o Gaming AI plays crucial

Ngày đăng: 29/05/2021, 11:28

Xem thêm:

TỪ KHÓA LIÊN QUAN

w