AI WEEK-1.pdf

Full Transcript

ARTIFICIAL INTELLEGENCE BSSE 5 SEMESTER TH SEAI-365 Credit Hour: 3(2+1) PRE-REQ: Data Structure Quizzes: 10 Assignment: 10 Presentation/Project: 5 Mid Term: 25 Final Term: 50 Total:...

ARTIFICIAL INTELLEGENCE BSSE 5 SEMESTER TH SEAI-365 Credit Hour: 3(2+1) PRE-REQ: Data Structure Quizzes: 10 Assignment: 10 Presentation/Project: 5 Mid Term: 25 Final Term: 50 Total: 100 INSTRUCTOR MS.SEHRISH MAQBOOL Week No. 1  What is artificial intelligence, the foundation, and the history of AI.  Different factors/behaviors counted as Intelligent.  How can we implement it in a computer system?  Lab 1 ARTIFICIAL INTELLIGENCE  AI is study to create “Digital Brain”. We have biological brain, it means we can think , reasoning or touch. So through AI, we want to make digital brain which can work like biological brain.  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. Goals of AI  To Create Expert Systems: The systems which exhibit intelligent behavior, learn, demonstrate, explain, and advice its users.  To Implement Human Intelligence in Machines: Creating systems that understand, think, learn, and behave like humans. Thinking Humanly Thinking Rationally “The exciting new effort to make computers “The study of mental faculties through the think... machines with minds, in the full and use of computational models.” (Charniak literal sense.” (Haugeland, 1985) and McDermott, 1985) “[The automation of] activities that we “The study of the computations that make it associate with human thinking, activities such possible to perceive, reason, and act.” as decision-making, problem solving, learning (Winston, 1992)...” (Bellman, 1978) Acting Humanly Acting Rationally “The art of creating machines that perform “Computational Intelligence is the study of functions that require intelligence when the design of intelligent agents.” (Poole et al., performed by people.” (Kurzweil, 1990) 1998) “The study of how to make computers do “AI... is concerned with intelligent behavior things at which, at the moment, people are in artifacts.” (Nilsson, 1998) better.” (Rich and Knight, 1991) Figure 1.1: Some definitions of artificial intelligence, organized into four categories. 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. Lets try to understand this phenomena of intelligence by using a few examples: Consider the following image where a mouse is trying to search a maze in order to find its way from the bottom left to the piece of cheese in the top right corner of the image. This problem can be considered as a common real life problem which we deal with many times in our life, i.e. finding a path, may be to a university, to a friends house, to a market, or in this case to the piece of cheese. The mouse tries various paths as shown by arrows and can reach the cheese by more than one path. In other words the mouse can find more than one solutions to this problem. The mouse was intelligent enough to find a solution to the problem at hand. Hence the ability of problem solving demonstrates intelligence.  Let us consider another problem. Consider the sequence of numbers below: 1, 3, 7, 13, 21, ____________________ If you were asked to find the next number in the sequence what would be your answer? Just to help you out in the answer let us solve it for you “adding the next even number to the” i.e. if we add 2 to 1 we get 3, then we add 4 to 3 we get 7, then we get 6 to 7 we get 13, then we add 8 to 13 we get 21 and finally if we’ll add 10 to 21 we’ll get 31 as the answer. Again answering the question requires a little bit intelligence. The characteristic of intelligence comes in when we try to solve something, we check various ways to solve it, we check different combinations, and many other things to solve different problems. All this thinking, this memory manipulation capability, this numerical processing ability and a lot of other things add to ones intelligence.  Let us consider another problem. All of you have experienced your college life. It was very easy for us to look at the timetable and go to the respective classes to attend them. Not even caring that how that time table was actually developed. In simple cases developing such a timetable is simple. But in cases where we have 100s of students studying in different classes, where we have only a few rooms and limited time to schedule all those classes. This gets tougher and tougher. The person who makes the timetable has to look into all the time schedule, availability of the teachers, availability of the rooms, and many other things to fit all the items correctly within a fixed span of time. He has to look into many expressions and thoughts like “If room A is free AND teacher B is ready to take the class AND the students of the class are not studying any other course at that time” THEN “the class can be scheduled”. This is a fairly simple one, things get complex as we add more and more parameters e.g. if we were to consider that teacher B might teach more than one course and he might just prefer to teach in room C and many other things like that. The problem gets more and more complex. We are pretty much sure than none of us had ever realized the complexity through which our teachers go through while developing these schedules for our classes. However, like we know such time tables can be developed. All this information has to reside in the developer’s brain. His intelligence helps him to create such a schedule. Hence the ability to think, plan and schedule demonstrate intelligence.  Consider a doctor, he checks many patients daily, diagnoses their disease, gives them medicine and prescribes them behaviors that can help them to get cured. Let us think a little and try to understand that what actually he does. A person goes to doctor, tells him that he is not feeling well. The doctor asks him a few questions to clarify the patient’s situation. The doctor takes a few measurements to check the physical status of the person. These measurements might just include the temperature (T), Blood Pressure (BP), Pulse Rate (PR) and things like that. For simplicity let us consider that some doctor only checks these measurements and tries to come up with a diagnosis for the disease. He takes these measurements and based on his previous knowledge he tries to diagnose the disease. His previous knowledge is based on rules like: “If the patient has a high BP and normal T and normal PR then he is not well”. “If only the BP is normal then what ever the other measurements may be the person should be healthy”, and many such other rules. The key thing to notice is that by using such rules the doctor might classify a person to be healthy or ill and might as well prescribe different medicines to him using the information observed from the measurements according to his previous knowledge. Diagnosing a disease has many other complex information and observations involved, we have just mentioned a very simple case here. However, the doctor is actually faced with solving a problem of diagnosis having looked at some specific measurements. It is important to consider that a doctor who would have a better memory to store all this precious knowledge, better ability of retrieving the correct portion of the knowledge for the correct patient will be better able to classify a patient. Hence, telling us that memory and correct and efficient memory and information manipulation also counts towards ones intelligence.  Let us give you an extremely simple problem. Things are not all that simple. People don’t think about problems in the same manner. Just tell us about your height. Are you short, medium or tall? An extremely easy question! Well you might just think that you are tall but your friend who is taller than you might say that NO! You are not. The point being that some people might have such a distribution in their mind that people having height around 4ft are short, around 5ft are medium and around 6ft are tall. Others might have this distribution that people having height around 4.5ft are short, around 5.5ft are medium and around 6.5ft are tall. Even having the same measurements different people can get to completely different results as they approach the problem in different fashion. Things can be even more complex when the same person, having observed same measurements solves the same problem in two different ways and reaches different solutions. But we all know that we answer such fuzzy questions very efficiently in our daily lives. Our intelligence actually helps us do this. Hence the ability to tackle ambiguous and fuzzy problems demonstrates intelligence.  Can you recognize a person just by looking at his/her fingerprint? Though we all know that every human has a distinct pattern of his/her fingerprint but just by looking at a fingerprint image a human generally can’t just tell that this print must be of person XYZ. On the other hand having distinct fingerprint is really important information as it serves as a unique ID for all the humans in this world. Let us just consider 5 different people and ask a sixth one to have a look at different images of their fingerprints. We ask him to somehow learn the patterns, which make the five prints distinct in some manner. After having seen the images a several times, that sixth person might get to find something that is making the prints distinct. Things like one of them has fever lines in the print, the other one has sharply curved lines, some might have larger distance between the lines in the print and some might have smaller displacement between the lines and many such features. The point being that after some time, which may be in hours or days or may be even months, that sixth person will be able to look at a new fingerprint of one of those five persons and he might with some degree of accuracy recognize that which one amongst the five does it belong. Only with 5 people the problem was hard to solve. His intelligence helped him to learn the features that distinguish one finger print from the other. Hence the ability to learn and recognize demonstrates intelligence.  Let us give one last thought and then will get to why we have discussed all this. A lot of us regularly watch television. Consider that you switch off the volume of your TV set. If you are watching a VU lecture you will somehow perceive that the person standing in front of you is not singing a song, or anchoring a musical show or playing some sport. So just by observing the sequence of images of the person you are able to perceive meaningful information out of the video. Your intelligence helped you to perceive and understand what was happening on the TV. Hence the ability to understand and perceive demonstrates intelligence. INTELLIGENCE Conclusion  The ability of problem solving demonstrates intelligence.  All the thinking, memory manipulation capability, numerical processing ability and a lot of other things add to ones intelligence.  The ability to think, plan and schedule demonstrate intelligence.  Memory and correct and efficient memory and information manipulation also counts towards ones intelligence.  The ability to understand and perceive demonstrates intelligence.  The ability to learn and recognize demonstrates intelligence.  The ability to tackle ambiguous and fuzzy problems demonstrates intelligence. Programming Without and With AI The programming without and with AI is different in following ways: Difference between Human and Machine Intelligence Humans perceive by patterns whereas the machines perceive by set of rules and data. Humans store and recall information by patterns, machines do it by searching algorithms. For example, the number 40404040 is easy to remember, store and recall as its pattern is simple. Humans can figure out the complete object even if some part of it is missing or distorted; whereas the machines cannot correctly  The computer would need to possess the following capabilities: Natural Language Processing: to enable it to communicate successfully in English; Knowledge Representation: to store what it knows or hears; Automated Reasoning: to use the stored information to answer questions and to draw new conclusions; Machine Learning: to adapt to new circumstances and to detect and extrapolate patterns The concept can be explained by an example. Consider you have a very intelligent machine that does a lot of tasks with a lot of intelligence. On the other hand you have very trivial specie e.g. a cat. If you throw both of them into a pool of water, the cat will try to save her life and would swim out of the pool. The “intelligent” machine would die out in the water without any effort to save itself. The mouse had strong Intelligence, the machine didn’t. If the machine has strong artificial intelligence, it would have used its knowledge to counter for this totally new situation in its environment. But the machine only knew what we taught it or in other wards only knew what was programmed into it. It never had the inherent capability of intelligence which would have helped it to deal with this new situation. THE FOUNDATIONS OF ARTIFICIAL INTELLIGENCE Philosophy of AI: Can formal rules be used to draw valid conclusions? How does the mind arise from a physical brain? Where does knowledge come from? How does knowledge lead to action?  Aristotle (384–322 B.C.), developed an informal system of syllogisms for proper reasoning, which in principle allowed one to generate conclusions mechanically, given initial premises.  Ramon Lull (d. 1315) had the idea that useful reasoning could actually be carried out by a mechanical artifact.  Thomas Hobbes (1588–1679) proposed that reasoning was like numerical computation, that “we add and subtract in our silent thoughts.  The first known calculating machine was constructed around 1623 by the German scientist Wilhelm Schickard (1592–1635), although the Pascaline, built in 1642 by Blaise Pascal (1623–1662), is more famous.  Pascal wrote that “the arithmetical machine produces effects which appear nearer to thought than all the actions of animals.  Gottfried Wilhelm Leibniz (1646–1716) built a mechanical device intended to carry out operations on concepts rather than numbers, but its scope was rather limited.  Thomas Hobbes suggested the idea of an “artificial animal,” arguing “For what is the heart but a spring; and the nerves, but so many strings; and the joints, but so many wheels. It’s one thing to say that the mind operates, at least in part, according to logical rules, and to build physical systems that emulate some of those rules; it’s another to say that the mind itself is such a physical system.  René Descartes (1596–1650) was an important thinker who discussed the differences between mind and matter. He argued that the mind and body are distinct, a view known as dualism.  According to Descartes, the mind (or soul) is separate from the physical world and not subject to physical laws, while animals, lacking this duality, are just complex machines.  Descartes was also a rationalist, believing that reason and logic are key to understanding the world. This philosophy, known as rationalism, was shared by other thinkers like Aristotle and Leibniz.  An alternative view is materialism, which suggests that the mind is just the brain working according to physical laws. In this view, free will is seen as an illusion, with choices merely appearing to be freely made by the mind. To understand the source of knowledge in a physical mind, we look at different philosophical approaches:  Empiricism: This approach, starting with Francis Bacon (1561–1626), argues that knowledge comes from sensory experiences. John Locke (1632–1704) summarized it by saying, "Nothing is in the understanding that was not first in the senses."  Induction: David Hume (1711–1776) proposed that we form general rules based on repeated experiences and associations between different things.  Logical Positivism: The Vienna Circle, led by Rudolf Carnap (1891–1970), developed this view in the early 20th century. It combines rationalism and empiricism, suggesting that all knowledge should be expressed through logical theories that are ultimately linked to sensory observations.  Confirmation Theory: Carnap and Carl Hempel (1905–1997) worked on this theory. Carnap’s book, The Logical Structure of the World (1928), presented a method for deriving knowledge from basic experiences, laying groundwork for viewing the mind as a computational process. These ideas collectively help us understand how knowledge can be structured and processed, which is fundamental to developing artificial intelligence.  A neuron, or nerve cell, has three main parts:  Cell Body (Soma): Contains the nucleus.  Dendrites: Branch-like fibers that receive signals.  Axon: A long fiber that sends signals to other neurons; it can be up to 1 meter long.  Neurons connect at junctions called synapses and communicate through electrochemical reactions. These connections are crucial for both immediate brain activity and long-term learning. Most brain processing happens in the cerebral cortex, which is organized into columns about 0.5 mm wide, each containing around 20,000 neurons.  An agent is just something that acts (agent comes from the Latin agere, to do). Of course, all computer programs do something, but computer agents are expected to do more: operate autonomously, perceive their environment, persist over a prolonged time period, adapt to change, and create and pursue goals.  A Rational agent is one that acts so as to achieve the best outcome or, when there is uncertainty, the best expected outcome. This diagram summarizes the history and evolution of AI in a comprehensive shape. Applications  Artificial finds its application in a lot of areas not only related to computer sciences but many other fields as well. We will briefly mention a few of the application areas and throughout the content of this booklet you will find various applications of the field in detail later.  Many information retrieval systems like Google search engine uses artificially intelligent crawlers and content based searching techniques to efficiency and accuracy of the information retrieval.  A lot of computer based games like chess, 3D combat games even many arcade games use intelligent software to make the user feel as if the machine on which that game is running is intelligent.  Computer Vision is a new area where people are trying to develop the sense of visionary perception into a machine. Computer vision applications help to establish tasks which previously required human vision capabilities e.g. recognizing human faces, understanding images and to interpret them, analyzing medical scan and innumerable amount of other tasks.  Natural language processing is another area which tries to make machines speak and interact with humans just like humans themselves. This requires a lot from the field of Artificial Intelligence.  Expert systems form probably the largest industrial applications of AI. Software like MYCIN and XCON/R1 has been successfully employed in medical and manufacturing industries respectively.  Robotics again forms a branch linked with the applications of AI where people are trying to develop robots which can be rather called as humanoids. Organizations have developed robots that act as pets, visitor guides etc. THE HISTORY OF ARTIFICIAL INTELLIGENCE Years Milestone / Innovation 1923 Karel Čapek’s play named “Rossum's Universal Robots” (RUR) opens in London, first use of the word "robot" in English. 1943 Foundations for neural networks laid. 1945 Isaac Asimov, a Columbia University alumni, coined the term Robotics 1950 Alan Turing introduced Turing Test for evaluation of intelligence and published Computing Machinery and Intelligence. Claude Shannon published Detailed Analysis of Chess Playing as a search. 1956 John McCarthy coined the term Artificial Intelligence. Demonstration of the first running AI program at Carnegie Mellon University. 1958 John McCarthy invents LISP programming language for AI. 1964 Danny Bobrow's dissertation at MIT showed that computers can understand natural language well enough to solve algebra word problems correctly. 1965 Joseph Weizenbaum at MIT built ELIZA, an interactive problem that carries on a dialogue in English. 1969 Scientists at Stanford Research Institute Developed Shakey, a robot, equipped with locomotion, perception, and problem solving. Years Milestone / Innovation 1973 The Assembly Robotics group at Edinburgh University built Freddy, the Famous Scottish Robot, capable of using vision to locate and assemble models. 1979 The first computer-controlled autonomous vehicle, Stanford Cart, was built. 1985 Harold Cohen created and demonstrated the drawing program, Aaron. 1990 Major advances in all areas of AI: Significant demonstrations in machine learning Case-based reasoning Multi- agent planning Scheduling Data mining, Web Crawler natural language understanding and translation Vision, Virtual Reality Games 1997 The Deep Blue Chess Program beats the then world chess champion, Garry Kasparov. 2000 Interactive robot pets become commercially available. MIT displays Kismet, a robot with a face that expresses emotions. The robot Nomad explores remote regions of Antarctica and locates meteorites. LAB 1 Tools/ Technologies: Python and PyCharm Installation: Python Language Download Anaconda Anaconda (Jupiter https://anaconda.org/ Notebook) Pycharm Pycharm https://www.guru99.com/how-to-install-python.html Google Colab Google Colab https://colab.research.google.com/ Pycharm is an Integrated Development Environment (IDE). Python is the language the developer will be writing in, whereas, PyCharm is the platform where they will be writing to create projects. Anaconda is a Science development platform and environment manager for python. Google Colab is Google's version of PyCharm, which allows you to execute Python and run your code. Google Colab provides access to powerful hardware, including GPUs and TPUs, which can accelerate the training of machine learning models. Download Anaconda/ Python Downloading the Python Installer Visit the download page for Continuum Analytic. (https://www.anaconda.com/products/individual). 1. NOTE: the installer is larger than the average file, because it contains Python, including packages, code editor, and some other gadgets. 2. You will be downloading the Python 3 version (any version 3.5 or later is good). If you download Python 2.7, our tutorial codes will not work. 3. Windows Operating System: Scroll to the "Anaconda for Windows" section. There are two versions of the installer, one for 32-bit Windows, and one for 64-bit Windows. Please choose the correct one for your machine! Downloading the Python Installer Installing Anaconda/ Python 1. To install Anaconda after downloading the graphical installer, double click the.exe (Windows) or.pkg (Mac) file and follow the instructions on the screen. 2. Additional notes and comments on installing/uninstalling Python can be found on the following link: https://docs.continuum.io/anaconda/install/ 3. When installing Anaconda, a pop-up menu may ask whether to “Add Anaconda to my PATH environment variable”, and “Register Anaconda as my default Python 3.5.” 4. The installation will take about 15 minutes. Click Finish to close the window when done. Starting Jupyter Notebook When you download and install the Anaconda distribution of Python, you are getting several tools related to Python development. There are two primary ways to access the tools and open Jupiter Notebook: 1. Windows Only: The Anaconda folder from the Start menu. 2. The Anaconda Navigator shortcut icon. Starting Jupyter Notebook Jupyter Application Overview Jupyter Application Overview Jupyter Application Overview For additional help on Jupyter Application, go to the Help menu! Installing and Testing Matplotlib and Numpy PyDynamic installation or any other packages  Please follow the following steps for installing the PyDynamic package: 1. Open Anaconda Navigator, and CMD.exe Prompt, 2. In the open CMD.exe Prompt, please write the next command conda install pip, and press the enter button, 3. Confirming the installation by writing the letter y, 4. Write the following command for the installation of the PyDynamic package pip install PyDynamic, 5. Congratulation, you have installed your first Python package for programming. PyDynamic installation or any other packages Packages installation using requirements file When creating Jupyter Notebooks, it is good to define requirements.txt file with required dependencies for usage. The following command will install the packages according to the configuration file requirements.txt: $ pip install -r requirements.txt Requirements.txt needs to be in the directory where the command is executed. If it is in another directory, the path needs to be specified. (Ready for the tutorials (n/y)?)

Use Quizgecko on...
Browser
Browser