AI material for you computer science.pptx

kerimu1235 23 views 59 slides Oct 16, 2024
Slide 1
Slide 1 of 59
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59

About This Presentation

arteficial inteligence


Slide Content

Ambo Woliso campus Department of Computer science Introduction to Artificial Intelligence(COSC3112) Instructor: Abdisa Lechisa

Chapter 4: Knowledge representation and reasoning What is Knowledge Knowledge includes facts about the real world entities and the relationship between them It is an understanding gained through experience familiarity with the way to perform a task an accumulation of facts, procedural rules, or heuristics Characteristics of Knowledge: It is voluminous in nature and requires proper structuring. It may be incomplete and imprecise. It may keep on changing (dynamic). 2

Knowledge(cont’d…) Knowledge-based Systems (KBSs) are useless without the ability to represent knowledge. Why Knowledge is important ? It enables to: Automate reasoning , Discover new facts, Deduce new facts that follow from the KB, and Answer users queries Make quality decisions - select courses of actions, etc. Hence, there is a need to represent knowledge to ease the development of an intelligent system. 3

What is knowledge representation? Knowledge representation and reasoning ( KRR) is the part of Artificial intelligence which concerned with AI agents thinking and how thinking contributes to intelligent behavior of agents . It is responsible for representing information about the real world so that a computer can understand and can utilize this knowledge to solve the complex real world problems such as: diagnosis a medical condition or communicating with humans in natural language. It is also a way which describes how we can represent knowledge in artificial intelligence. Knowledge representation is not just storing data into some database, but it also enables an intelligent machine to learn from that knowledge and experiences so that it can behave intelligently like a human. 4

What to Represent Following are the kind of knowledge which needs to be represented in AI systems: Object:  All the facts about objects in our world domain. Events:  Events are the actions which occur in our world. Performance:  It describe behavior which involves knowledge about how to do things. Meta-knowledge:  It is knowledge about what we know. Facts:  Facts are the truths about the real world. Knowledge-Base:  The central component of the knowledge-based agents is the knowledge base. The Knowledgebase is a group of the Sentences (Here, sentences are used as a technical term and not identical with the English language). 5

Approaches to knowledge representation Simple relational knowledge It is the simplest way of storing facts which uses the relational method, and each fact about a set of the object is set out systematically in columns. This approach of knowledge representation is famous in database systems where the relationship between different entities is represented. 6

Approaches to knowledge representation(cont’d…) Inheritable knowledge: In the inheritable knowledge approach, all data must be stored into a hierarchy of classes. All classes should be arranged in a generalized form or a hierarchal manner. In this approach, we apply inheritance property. Elements inherit values from other members of a class. This approach contains inheritable knowledge which shows a relation between instance and class, and it is called instance relation. 7

Approaches to knowledge representation(cont’d…) Inferential knowledge Inferential knowledge approach represents knowledge in the form of formal logics. This approach can be used to derive more facts Procedural knowledge Procedural knowledge approach uses small programs and codes which describes how to do specific things, and how to proceed. In this approach, one important rule is used which is  If-Then rule . 8

Knowledge-based Agent (KBA) Agents can be seen as knowing about their world, and reasoning about their possible courses of action. KBA begins with some knowledge of the world and of its actions. It uses logical reasoning to maintain a description of the world as new percepts arrive Learn new facts/knowledge that are inferred and unseen by current percepts Deduce a course of actions that will achieve its goals One can also design an autonomous agent that learns from experience and construct knowledge with less human interventions 9

Knowledge engineering (KE) KE is the process of building a knowledge base through extracting the knowledge from the human expert. Knowledge engineering is the process of Extracting the knowledge from the human expert. Choose knowledge representation formalism Choose reasoning and problem solving strategy. A knowledge engineer is someone who investigates a particular domain, determines what concepts are important in that domain, and creates a formal representation of the objects and relations in the domain. A KE has to decide what objects and relations are worth representing, and which relations hold among which objects 10 Knowledge acquisition ( Extract knowledge of Human Expert) Knowledge Representation (choose KR Method & reasoning strategy) Knowledge Base

The two main tasks of KE Knowledge acquisition: The knowledge engineer interview the real human experts to be educated about the domain and to elicit the required knowledge, in a process called knowledge acquisition Knowledge Representation techniques such as logic are a powerful tool for KR and reasoning. However, such techniques consists of only the syntax, semantics and proof theory. Knowledge base is used to store a set of facts and rules about the domain expressed in a suitable representation language Each individual representation are called sentences Sentences are expressed in a (formal) knowledge representation (KR) language 11

Logic as KR A Logic is a formal language in which knowledge can be represented such that conclusions can easily be drawn. It is a declarative language to assert sentences and deduce from sentences. Components of a formal logic include syntax, semantics, reasoning and inference mechanism. Syntax: what expressions/structures are allowed in the language . Describes how to make sentences E.g. mycar (red) is ok, but mycar(grey or green) is not. Semantics : express what sentences mean, in terms of a mapping to real world. The meaning of a sentence is not intrinsic to that sentence. Semantics relate sentences to reality. E.g. mycar (red) means that my car is red. Proof Theory: It is a means of carrying ou t reasoning using a set of rules. It helps to draw new conclusions from existing statements in the logic. 12

Why formal languages (Logic) ? An obvious way of expressing or representing facts and thoughts is by writing them in a natural language such as English, A faan Oromo , etc. However , The meaning of a sentence depends on the sentence itself and on the context on which the sentence was spoken e.g. Look! Natural languages exhibit ambiguity. E.g. small dogs and cats. A single sentence can usually be interpreted in more than one way, possibly inhibiting reasoning Ambiguity makes reasoning difficult and incomplete . Hence we need formal languages to express facts and concepts in an unambiguous and well-defined way. 13

Propositional logic A simple language useful for showing key ideas and definitions Syntax: PL allows facts about the world to be represented as sentences formed from: Logical constants : True, False Proposition symbols ( P, Q, R, …) are used to represent facts about the world: e.g.: P = "It is hot“, Q = "It is humid“, R = "It is raining“ Logical connectives : not ( ) , and ( ), or (  ), implies (  ), is equivalent, if and only if (  ). Precedence order from highest to lowest is:  ,  ,  ,  ,  e.g. The sentence P v Q  R  S is equivalent to [ ( P) v (Q  R)]  S Parenthesis ( ): Used for grouping sentences and to specify order of precedence 14

Propositional logic (PL) sentences A sentence is made by linking prepositional symbols together using logical connectives. There are atomic and complex sentences. Atomic sentences consist of propositional symbol (e.g. P, Q, TRUE, FALSE) Complex sentences are combined by using connectives or parenthesis: while S and T are atomic sentences, S  T, (S  T), (S  T), (S  T), and (S  T) are complex sentences . Examples: Given the following sentences about the “ weather problem” convert them into PL sentences: “It is humid.”: “If it is humid, then it is hot” : “If it is hot and humid, then it is raining”: 15

Terminology Valid sentence : A sentence is valid sentence or tautology if and only if it is True under all possible interpretations in all possible worlds. Satisfiable : A sentence is satisfiable if and only if there is some interpretations in some world for which the sentence is True. Example : “It is raining or it is humid”. R v Q Unsatisfiable : A sentence is unsatisfiable (inconsistent sentence or self- contradiction) if and only if it is not satisfiable, i.e. a sentence that is False under all interpretations. The world is never like what it describes. Example : “It’s raining and it's not raining.” R   R 16

First Order Logic FOL represents objects and relations between objects, variables, and quantifiers in addition to propositions First-Order Logic (FOL) is expressive enough to concisely represent any kind of situation that are expressed in natural language. For example: Every elephant is gray:  x (elephant(x) → gray(x)) 17

Syntax of FOL Constants symbol names (like Jonas, Kebede, …), numbers (like 1, 2, … n), ... Predicates : Predicates used to relate one object with another. E.g. brother, >,... Functions : Returns value ( Sqrt, mother-of,... ) V ariables : x, y, a, b,... Important to increase generalization capability of KB Connectives : retains connectives used in PL (  ,  , , ,  ) Quantifiers : Quantifiers specify whether all or some objects satisfy properties or relations between objects Two standard quantifiers: Universal ( " for all, for every ) and Existential ( $ there exists, some) 18

Universal quantification Universal Quantifiers : makes statements about every object  < variables > < sentence > Everyone at AUWC is smart:  x At(x, AUWC )  Smart(x) All cats are mammals:  x cat(x)  mammal (x)  x sentence P is true iff P is true with x being each possible object in the given universe The above statement is equivalent to the conjunction At(Jonas, AUWC )  Smart(Jonas)  At(Rawd a , AUWC )  Smart(Rawad)  A common mistake to avoid Typically,  is the main connective with  Common mistake : the use of  as the main connective with  :  x At(x, AUWC )  Smart(x) is true if “Everyone is at AUWC & everyone is smart” 19

Existential quantification Makes statements about some objects in the universe  < variables > < sentence > Someone at AUWC is smart:  x ( x, AUWC )  Smart(x)  x sentence P is true iff P is true with x being some possible objects The above statement is equivalent to the disjunction (Jonas , AUWC )  Smart(Jonas)  ( Alemu , AUWC )  Smart(Alemu)  ….. Common mistake to avoid Typically,  is the main connective with  Common mistake: using  as the main connective with  :  x ( x, AUWC )  Smart(x) is true if there is anyone who is not at AUWC 20

C hapter five: machine learning It has been long understood that learning is a key element of intelligence for both natural intelligence and artificial intelligence Making a computer automatically acquire some kind of knowledge from a concrete data domain by learning Algorithm 21

How does Machine Learning Works? It is a technique which works intelligently by using some complex algorithms and set of predefined rules. It uses the past data to read the patterns and then based on the analysis it generates the relevant data or performs the intended task abiding the defined rules and algorithms. For example, whenever we typed in something on the search bar, the search engines uses this machine learning technique to display the related contents. It intelligently reads the vast data on the web, index it and rank it based on the defined rules and algorithm then finally it displays the search results. 22

Basic steps of machine learning The first step is to gathering the past data from the various sources such as excel files, text files or any other provider. The quality of related data is the foundation of learning for the software T he more relevant the data, the better learning for the software. The next step is data preparation . The programmer spends time on preparing the quality data and fixing the data issues. The missing data should be rectified to improve the data quality. 23

steps of machine learning(cont’d…) Develop the data model with appropriate algorithms. The models are developed and tested with relevant algorithms which enable the software to read the correct data sets intelligently in the real world. Next step is testing the model’s accuracy using the data sets used while developing the models and also the data sets which were not used while developing the models. It shows the model’s performance and accuracy with the optimum level of precisions. Finally, check and improve the performance by using various data sets which were not used earlier. 24

Types of machine learning T he four common machine learning algorithm types are: Supervised machine learning algorithms. Unsupervised machine learning algorithms. Semi-supervised machine learning algorithms. Reinforcement machine learning algorithms. 25

Supervised learning Extract information or knowledge from labeled training data and oversight from a developer or programmer. . We are given an input, for example: a photograph with a traffic sign, and the task is to predict the correct output or label , for example which traffic sign is in the picture (speed limit, stop sign, etc.). In the simplest cases, the answers are in the form of yes/no (we call these binary classification problems ). Instead of manually writing down exact rules to do the classification, the point in supervised machine learning is to take a number of examples or label use them to “train” an AI method to automatically recognize the correct Has two steps: Learning : Learn a model using the training data Testing : Test the model using test data to assess the model accuracy 26

Unsupervised learning A lgorithm used to draw inferences from training datasets without labeled responses. They are not directly controlled by a developer They are used to identify patterns , trends or grouping in a dataset where these elements are unknown. This type of machine learning can identify the relationship between different data points and be used to segment similar data. The main goal of unsupervised learning is discovering the fundamental structure of the data The most common unsupervised learning method is cluster analysis Clustering : the process of dividing the datasets into groups, consisting of similar data-points reducing the data to a small number of important dimensions . Data visualization can also be considered unsupervised learning . 27

Reinforcement learning Algorithm learns to react to an environment . Commonly used in situations where: an AI agent like a self-driving car must operate in an environment and Also used in games where the outcome may be decided only at the end of the game . Allows a system to learn and improve the performance of a function through trial and error. The model will find the best solution to a problem in a specific environment by learning from past actions. The process is a feedback loop in which successful actions are rewarded and reinforced . E.g Teinforcement machine learning model is the Markov Decision Process (MDP). The technique uses reward and decision processes to ensure a model takes the optimal action in its current state. 28

Semi-supervised machine learning S emi-supervised machine learning is a blend of supervised and unsupervised approaches . It combines elements of both types of machine learning algorithms. It is used with datasets that have only a portion of data accurately labelled . Semi-supervised machine learning algorithms are trained on the subset of correctly labelled data. The model then uses this training to label the remaining unlabelled data in the sample. Semi-supervised machine learning uses the classification process from supervised machine learning to understand the desired relationships between data points. It then uses the clustering process from other unsupervised machine learning algorithms to group the remaining unlabelled data. 29

What are neural networks? A neural network: either biological and artificial, consists of a large number of simple units called neurons , that receive and transmit signals to each other. The neurons are very simple processors of information, consisting of a cell body and wires that connect the neurons to each other. Most of the time, they do nothing but sit still and watch for signals coming in through the wires. 30

Dendrites, axons, and synapses In the biological lingo, we call the wires that provide the input to the neurons dendrites . Sometimes, depending on the incoming signals, the neuron may fire and send a signal out for the other neurons to receive. The wire that transmits the outgoing signal is called an axon . Each axon may be connected to one or more dendrites at intersections that are called synapses . 31

Dendrites, axons, and synapses Isolated from its fellow-neurons, a single neuron is quite unimpressive, and capable of only a very restricted set of behaviors. When connected to each other, however, the system resulting from their concerted action can become extremely complex . The behavior of the system is determined by the ways in which the neurons are wired together . Each neuron reacts to the incoming signals in a specific way that can also adapt over time. This adaptation is known to be the key to functions such as memory and learning . 32

Why develop artificial neural networks? The purpose of building artificial models of the brain can be N euroscience , the study of the brain and the nervous system in general. It is tempting to think that by mapping the human brain in enough detail, we can discover the secrets of human and animal cognition and consciousness . 33

Why develop artificial neural networks? In fact, another main reason is, for building artificial neural networks It is to use biological systems as an inspiration to build better AI and machine learning techniques. The idea is very natural: the brain is an amazingly complex information processing system capable of a wide range of intelligent behaviors and therefore, it makes sense to look for inspiration in it when we try to create artificially intelligent systems. 34

Neural network key feature For one, in a traditional computer, information is processed in a central processor which can only focus on doing one thing at a time. The CPU can retrieve data to be processed from the computer ’ s memory and store the result in the memory. Thus, data storage and processing are handled by two separate components of the computer: the memory and the CPU. In neural networks, the system consists of a large number of neurons: each of which can process information on its own so that instead of having a CPU process each piece of information one after the other, the neurons process vast amounts of information simultaneously . 35

Neural network key feature 36 The second difference is that data storage (memory) and processing is n o t separated like in traditional computers. The neurons both: store and process information so that there is no need to retrieve data from the memory for processing. The data can be stored short term in the neurons themselves Because of these two differences: neural networks and traditional computers are suited for somewhat different tasks. Even though it is entirely possible to simulate neural networks in traditional computers, which was the way they were used for a long time, their maximum capacity is achieved only when we use special hardware

Architecture of artificial neural network The circles are neurons or nodes, with their functions on the data the lines/edges connecting them are the weights/information being passed along the data. There is an input layer which has many sensors to collect data from the outside world. On the right hand side, we have an output layer that gives us the result predicted by the network. In between these two, several layers are hidden. 37

How neural network work? The basic artificial neuron model involves a set of adaptive parameters, called weights these weights are used as multipliers on the inputs of the neuron The sum of the weights times the inputs is called the linear combination of the inputs. Take shopping bill as analogy : you multiply the amount of each item by its price per unit and add up to get the total . If we have a neuron with six inputs (analogous to the amounts of the six shopping items: potatoes , carrots, and so on), input1, input2, input3, input4, input5, and input6, we also need six weights. The weights are analogous to the prices of the items. We can then calculate the linear combination like this: linear combination = weight1 × input1 + ... + weight6 × input6 38

How neural network work? Once the linear combination has been computed, the neuron does one more operation. It takes the linear combination and puts it through a so-called activation function . An Activation Function  decides whether a neuron should be activated or not. This means that it will decide whether the neuron’s input to the network is important or not in the process of prediction using simpler mathematical operations.  39

How neural network work? The network typically also has: hidden layers that use the other neurons´ outputs as their input, and whose output is used as the input to other layers of neurons. Finally, the output layer produces the output of the whole network. All the neurons on a given layer get inputs from neurons on the previous layer and feed their output to the next. 40

Types of ANN based on Topology A network topology is the arrangement of a network along with its nodes and connecting lines. According to the topology, ANN can be classified as: Feedforward Network It is a non-recurrent network having processing units/nodes in layers and all the nodes in a layer are connected with the nodes of the previous layers. The connection has different weights upon them. There is no feedback loop means the signal can only flow in one direction, from input to output. 41

Feedforward Network It may be divided into the following two types: Single layer feedforward network  − The concept is of feedforward ANN having only one weighted layer. In other words, we can say the input layer is fully connected to the output layer. 42

Feedforward Network(cont’d…) Multilayer feedforward network  − The concept is of feedforward ANN having more than one weighted layer. As this network has one or more layers between the input and the output layer, it is called hidden layers. 43

Feedback Network F eedback network has feedback paths, which means the signal can flow in both directions using loops. It is also called recurrent network .It may be divided into the following types − Fully recurrent network and Jordan network 44

Feedback Network(cont’d…) Fully recurrent network  − It is the simplest neural network architecture because all nodes are connected to all other nodes and each node works as both input and output. Jordan network  − It is a closed loop network in which the output will go to the input again as feedback as shown in the following diagram. 45

Chapter 6: Natural language processing Natural Language: The system of communication in speech and writing In contrast to artificial languages programming languages and mathematical notations A language is not random It is composed of rules. Even though it is hard to pin down with explicit rules 46

Natural language processing Natural Language Processing (NLP) is a component of Artificial Intelligence Perform useful tasks involving human language like: enabling human-machine communication, improving human-human communication, or useful processing of text or speech making a machine to analyze, understand, and generate human speech. NLP is concerned with enabling computers to process human languages like: English, French Amharic, Oromia, Tigrinya etc... 47

NLP Basic Fields Two Aspects to be discussed: Natural Language Understanding: machine reading comprehension. Natural language generation: generating natural language from a machine representation system such as a knowledge base or logical form. 48

NLP Applications Spell and grammar checker Checking spelling and grammar Suggesting alternatives for errors Predicting the next word highly probable to be typed by the user. Information retrieval Finding relevant information for user query Text categorization assigning one or more predefined category for a text 49

NLP Applications Generating short summary from one or more documents some times based on query Question answering Answering questions with short answer Information extraction Extracting important concepts from texts Machine translation Translating the language from one language to another Sentiment analysis Identifying sentiments and opinions stated in the text 50

NLP Applications Optical character recognition Recognizing printed or hand written character. Speech recognition Recognizing spoken language and transforming it to text Speech synthesis Producing speech from a text Spoken dialogue system Running dialogue between user and the system 51

Steps in NLP 52

Steps in NLP Morphology Deals with word formation Words are formed from morphemes , the smallest units of meaning. Morphology deals with the syntax of complex words and parts of words Understanding how words are formed and what semantic properties they convey through their forms 53

Steps in NLP Lexical Analysis Identifying and analyzing the structure of words . Lexical analysis is dividing the whole chunk of text into words. Lexicon of a language means the collection of words and phrases in a language . Techniques : Regular expressions and Pattern rules 54

Steps in NLP Syntactic analysis: It analysis of words in the sentence for grammar and arranging words in a manner that shows the relationship among words For Examples: “The school goes to boy” is rejected by English syntactic analyzer Technique :parsing, Context-Free Grammar 55

Steps in NLP Semantic Analysis It draws the exact meaning or the dictionary meaning from the text. The text is checked for meaningfulness. It is done by mapping syntactic structures and objects in the task domain 56

Steps in NLP Discourse Integration The meaning of any sentence depends upon the meaning of the sentence just before it.  This analysis involves considering not only sentence structure and semantics but also sentence combination and meaning of the text as a whole. Pragmatic analysis Derives knowledge from external common sense information. It means understanding the purposeful use of language in various situations, particularly those aspects of language that require world knowledge. 57

Approaches of NLP symbolic approach It is based on human-developed rules and lexicons . Rule-based systems usually consist of a set of rules, an inference engine. Knowledge is represented as facts or rules in the rule-base. The inference engine repeatedly selects a rule whose condition is satisfied and executes the rules 58

Approaches of NLP(cont’d…) Machine learning approaches: employ various mathematical techniques often use large text corpora to develop approximate generalized models of linguistic phenomena based on actual examples of phenomena provided by the text corpora without adding significant linguistic or world knowledge. Connectionist approaches: It develop generalized models from examples of linguistic phenomena. It also develop a network of interconnected between two words with knowledge. 59
Tags