Slides:



Advertisements
Similar presentations
Python Objects and Classes
Advertisements

1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
The Web Warrior Guide to Web Design Technologies
© by Pearson Education, Inc. All Rights Reserved.
Intro to Robots 10 Artificial Intelligence “I want to make a computer that will be proud of me” Daniel Hillis.
Computer Science - I Course Introduction Computer Science Department Boston College Hao Jiang.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Mobiles Robotics: Integrated Systems Design. Where are the Robots? Exploration.
CSC 9010: Natural Language Processing
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
Ruby (on Rails) CSE 190M, Spring 2009 Week 1. The Players Kelly "Everyday I'm Hustlin' " Dunn Kim "Mouse" Todd Ryan "Papa T" Tucker.
Computer Science 101 Introduction to Programming.
1 CSC 221: Introduction to Programming Fall 2012 course overview  What did you set out to learn?  What did you actually learn?  Where do you go from.
Javascript and the Web Whys and Hows of Javascript.
Introduction to Python Lecture 1. CS 484 – Artificial Intelligence2 Big Picture Language Features Python is interpreted Not compiled Object-oriented language.

Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.

Java: Chapter 1 Computer Systems Computer Programming II.
Functions Part I (Syntax). What is a function? A function is a set of statements which is split off into a separate entity that can be used like a “new.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Introduction to Programming Peggy Batchelor.
Computer Science 101 Introduction to Programming.
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
Lecture Set 2 Part B – Configuring Visual Studio; Configuration Options and The Help System (scan quickly for future reference)
Programming With C.
Input, Output, and Processing
Ruby on Rails. What is Ruby? Programming Language Object-oriented Interpreted.
Q and A for Sections 2.9, 4.1 Victor Norman CS106 Fall 2015.
Mobiles Robotics: Integrated Systems Design. Where are the Robots? Exploration.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Course Overview  What is AI?  What are the Major Challenges?  What are the Main Techniques?  Where are we failing, and why?  Step back and look at.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)

Alice and Java Unit 7 1. Day 1  Objective: Gain an introduction to Java and Eclipse  Essential skill: DM-1: Use technology to advance critical thinking.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Quiz 3 next week. See next slide. Both versions of assignment 3 are posted. Due today.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
C++ Programming Basics C++ Lecture 1 Stacy MacAllister.
Q and A for Sections 2.9, 4.1 Victor Norman CS106 Fall 2015.
CS 151: Introduction to Artificial Intelligence Professor Sara Owsley Sood.
Whatcha doin'? Aims: To start using Python. To understand loops.
Introduction to Artificial Intelligence
Introduction to Python
Done Done Course Overview What is AI? What are the Major Challenges?
Variables, Expressions, and IO
Functions CIS 40 – Introduction to Programming in Python
Conditional Execution
CSCI 5582 Artificial Intelligence
CISC101 Reminders Assn 3 due tomorrow, 7pm.
T. Jumana Abu Shmais – AOU - Riyadh
Introduction to TouchDevelop
Conditional Execution
G. Pullaiah College of Engineering and Technology
12th Computer Science – Unit 5
Chapter 1: Programming Basics, Python History and Program Components

Input and Output Python3 Beginner #3.
General Computer Science for Engineers CISC 106 Lecture 03
CISC101 Reminders Assignment 3 due today.
Functions, Procedures, and Abstraction
Introduction to Python
Presentation transcript:

CS311 David Kauchak Spring 2013 Intro to AI & Intro to Python Adapted from notes from: Sara Owsley Sood CS311: Introduction to Artificial Intelligence

Who are you and why are you here? Name/nickname Major and year What is AI? (or what do you think AI is? ) Why are you taking this course? What topics would you like to see covered?

Course goals Be able to answer the question “What is AI”? Learn and apply basic AI techniques… … to solve real-world (current) problems, and in the process… …appreciate how HARD AI really is (and why)

AI is a huge field So, what is AI… One definition: “Building programs that enable computers to do what humans can do.” For example: read, walk around, drive, play games, solve problems, learn, have conversations…

How do we measure success? there are many interpretations of this goal… Think like a human Cognitive Modeling Think rationally Logic-based Systems Act like a human Turing Test Act rationally Rational Agents thinking vs. acting human vs. rational “Building programs that enable computers to do what humans can do.”

How is AI viewed in popular media?

What challenges are there?

Perception perceive the environment via sensors Computer vision (perception via images/video) process visual information object identification, face recognition, motion tracking Natural language processing and generation speech recognition, language understanding language translation, speech generation, summarization

What challenges are there? Knowledge representation encode known information water is wet, the sun is hot, Dave is a person, … Learning learn from environment What type of feedback? (supervised vs. unsupervised vs. reinforcement vs …) Reasoning/problem solving achieve goals, solve problems planning How do you make an omelet? I’m carrying an umbrella and it’s raining… will I get wet? Robotics How can computers interact with the physical world?

What can we currently do? Understand spoken language? speech recognition is really good, if: restricted vocabulary specific speaker with training Gotten quite good in the last few years and shows up in lots of places: Mac has built-in dictation software Siri is pretty good (though there’s more than speech recognition going on there) Google allows you to search via voice command What does the spoken language actually mean (language understanding)? much harder problem! many advances in NLP in small things, but still far away from a general solution

What can we currently do? Speak? Understandable, but you wouldn’t confuse it for a person Can do accents, intonations, etc. Better with restricted vocabulary Loquendo Dealing with facial expression is challenging Kismet (MIT)

What can we currently do? Freeway driving is relatively straightforward Off-road a bit harder see DARPA grand challenges (2004, 2005) And urban driving is even trickier See DARPA urban challenge (2007) Google’s autonomous vehicle Drive a car? Hint: there’s a connection here

What can we currently do? Identify emotion? This is hard! Some success in text movie reviews blogs twitter dealing with sarcasm is hard Some success with faces strongly biased by training data works best when exaggerated

What can we currently do? Reasoning? Success on small sub-problems General purpose reasoning is harder Wolfram Alpha OpenCyc

What can we currently do? Walk? Robots have had a variety of locomotion methods Walking with legs, is challenging Differing terrains, stairs, running, ramps, etc. Recently, a number of successes Honda’s Asimo Sony QRIO Boston Dynamic’s Big Dog

When will I have my robot helper?

What can we currently do? Vacuum? Clean the floor? Mow the lawn?

What can we currently do? Fold a pile of towels? UC Berkeley towel folding robot:

Administrivia go/cs311 Office hours, schedule, assigned readings, problem sets Everything will be posted here Read the “administrivia” page! ~4 programming assignments (in Python) ungraded written assignments quizzes 2 exams (dates are tentative) final project for the last month teams of 2-3 people research-like with write-up and presentation class participation readings Academic honesty and collaboration

Python basics >>> x = 5 #no variable types or declarations >>> y = 10.0 #python has implicit typing >>> type(y) # gets the type of an expression >>> type(x) >>> x + y #meaning that the type is implied by whatever #you do to the variable 15.0 >>> type(x + y) >>> x = 'hi there' >>> x + y Traceback (most recent call last): File " ", line 1, in TypeError: cannot concatenate 'str' and 'int' objects >>> x + str(y) 'hi there10'

More python fun >>> x[0] ##treat a string as a list 'h' >>> x[0:4] ##substring of a string is a sublist - slices 'hi t’ >>> x[-1] ‘e’ >>> x[-3:] ‘ere’ >>> myL = [2]*5 ##can do powerful things >>> myL ##what do you think this will do? [2, 2, 2, 2, 2] >>> myL[2] = 0 >>> x = 1 >>> y = ‘hello’ >>> x, y = y, x >>> x ‘hello’ >>> y 1

Defining functions look at functions.py def defines a new function : indicates the beginning of a new block of text no curly braces (for better or worse) a block is indicated by it’s indentation DON’T MIX SPACES AND TABS Whatever editor you use look up how to “Auto-expand” tabs into spaces! == for equality True and False

External files You can edit in your favorite text editor (for example Aquamacs or TextWrangler). You could also use an IDE like IDLE or WingIDE if you’d like. When you’re ready, you can import the commands in the file using import >>> import functions # don’t include the.py >>> L = [1,2,3,4] >>> functions.listSearch(L, 5) False >>> functions.listSearch(L, 1) True

External files You can edit in your favorite text editor (for example Aquamacs or TextWrangler). You could also use an IDE like IDLE or WingIDE if you’d like. If you don’t want to have to type. before the commands: >>> from functions import * # don’t include the.py >>> L = [1,2,3,4] >>> listSearch(L, 5) False >>> listSearch(L, 1) True

STDOUT and STDIN look at IO.py print prints to the console (you can use it in functional form with () or without) help(raw_input) takes an optional prompt which is printed to the user returns a string we typecast it to an int using int() can get a typecast error if user doesn’t enter an int notice that this is a script! Python executes from the top of the file to the bottom Functions must be declared before calling The last line is the method call to the function

Defining classes look at polygon class in classes.py class : again, denotes a new block of code self should be the first argument to any class method It allows you to use the ‘.’ notation for calling methods It gives you a handle to the data associated with the current object When you call the method, you don’t actually specify it __init__ is similar to a constructor p = polygon(…) __str__ is similar to toString in Java and is called whenever an object is printed we can define optional parameters using ‘=‘ in the parameter list must be the last parameters in the list if not specified, they get the default value can specify using the name if desired

Defining classes look at box class in classes.py can define multiple classes in a file (and filename doesn’t matter, remember these are just scripts. You could type these into the interpreter if you’d like) isinstance function is similar to instanceof in Java

provide all of the methods and data members available to an object No memorizing! Just use dir & help… (and online documentation ) help(listSearch) dir(“foo”) help(“foo”.split) dir(str) help(str.split) dir(42) dir([]) dir and help !

Comments and docstrings # denotes a comment (use them!) """ denotes a multi-line string. When put at the top of a file or as the first line in a function definition these provide documentation via help (use them!) help(classes)