ברוכים הבאים! מבוא לקורס ולשפת python

Post on 01-Jan-2016

50 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

ברוכים הבאים! מבוא לקורס ולשפת Python. מבוא לבינה מלאכותית (236501) מדעי המחשב, טכניון עומר גייגר חורף 2014-15. AI. קצת מנהלות. ברוכים הבאים לקורס! בשם הצוות: פרופ' שאול מרקוביץ' יום ה' 12:30-14:30 ליאור פרידמן ד' 9:30-10:20 מיטל מסינג ג' 16:30-17:20 - PowerPoint PPT Presentation

TRANSCRIPT

! הבאים ברוכיםולשפת לקורס Pythonמבוא

מלאכותית ) לבינה (236501מבוא , טכניון המחשב מדעי

גייגר עומר2014-15AIחורף

... מנהלות קצת

! לקורס הבאים ברוכים: הצוות בשם

' מרקוביץ' שאול ' פרופ ה 12:30-14:30יוםפרידמן 9:30-10:20ד' ליאור

מסינג 16:30-17:20ג' מיטל) אחראי ) מתרגל גייגר 9:30-10:20ב' עומר

רביד בפייתון נועם תגבורים

• ) ( ) כל ) לאורך קבועה תרגול קבוצת ילמד ת מתרגל כל קודמות לפעמים בניגוד הסמסטר. הקורסים ברוב כנהוג הסמסטר

•. , : אלגוריתמים נתונים מבני קדם דרישות

•: הקורס מטלותב 3- תכנות המשלבים חובה .Pythonתרגילי " יבש ח ודו-. מסכמת בחינה

הקורס מטלות

כבישים – 1תרגיל ברשת חיפוש בעיית שחקנים – 2תרגיל שני משחק תחרות

למידה – 3תרגיל בתחום ניסוי

: הציון הרכב1שב 2שב 3שב מבחן

בונוסים + 40% 60%

... הקורס על

- . מלאכותית בינה של המרתק לתחום מבוא קורס זהו- . , – " קיימות" כמומחים נסיים לא מהתחום נטעם הסמסטר במהלך מבוא

. לה ומחוצה בפקולטה העמקה להמשך אפשרויות- , , : - " אלגוריתמים" תכנות המחשב מדעי ביסודות ידע נניח מתקדם קורס

. ומתמטיקה נתונים מבניהקורס - בתרגילי אמפיריבדגש יוריסטיאופי תכנות מיומנויות שילוב תוך

הבית.- , , אינה אך לעיתים תופיע הקבוצות תורת בעיקר פורמאלית מתמטיקה

הדגש. ב - !Pythonתכנות , בבית – הרבה היום מעט

AI=sex

y

!

? מלאכותית בינה מהי-. : אדם לחקות המסוגלות מערכות טיורינג מבחן- , , \ לתכנן לחוש המסוגלים אוטונומיים חומרה תוכנה סוכני

. , , , להפעיל ללמוד להכליל מסקנות להסיק

The study and design of intelligent agents (Poole et al. ‘98)

The science and engineering of making intelligent machines (McCarthy, ‘95)

The science of making computers do things that require intelligence when done by humans (http://www.alanturing.net)

Deduction, reasoning & problem solving Knowledge representationPlanning LearningNatural languageMotion and manipulation PerceptionSocial intelligence Creativity General intelligence

(Wikipedia)

? בקורס נלמד מה

לבעיה • מצבים מרחבי הגדרתבמרחבים • מיודעים ולא מיודעים חיפוש אלגוריתמיאלגוריתם - • שלו- Minimax משחקים ווריאציות ופתרון )• וחיפוש לוגיים אילוצים Constraint Satisfactionייצוג

Problems)לומדות )• (Machine Learningמערכותנוספים ...• נושאים ואולי

Through examples

Python – מומלצים מקורות) עצמית) ללמידה

• : הרשמי //:httpהאתר .python org/ ! גרסה) – לב שימו הסביבה את להוריד מומלץ גם ( 2.7.3מכאן

• : הרשמי המדריך:// . . /2/ /http docs python org tutorial

•. כרפס - ארז באדיבות הקורס שבאתר סיכומים• : ברשת נוספים אתרי, stackoverflowחומרים

. ואחרים אוניברסיטאות

Python המזלג קצה על

•Compact code. מהיר - ומימוש קצר פיתוח•High Level. אבסטרקטיים - נתונים מבני•Interpreted . ומתבצע - ריצה בזמן מפוענח קוד•Dynamic typing. למשתנה - ולא לאובייקט משויך הטיפוס•Strongly typed - בדרישה רק טריוויאליות לא המרות

מפורשת.•Object Oriented. " , , ב - וכיו ירושה אובייקטים מחלקות•Platform compatible Virtual Machine:,

Win 32/64, Unix, Linux, Mac...

Python vs. C/C++

C \ C++1. Code2. Compile3. Run

Much Shorter!!!

Python1. Code2. Run

Another option(Interactive shell):1. Code & Run!

Built-in types

Basic arithmetics: + - * /Modulu: %Div: //Power: **Boolean bit ops: & (and) | (or) ^ (xor) ~ (neg 2’s comp.)Bit shift: <<, >>Assign and op: +=, **=, ^= etc…Logical: and, or, notComparison: <, >, <=, >=, ==

Generally, Operators are overloaded for all reasonable operand types

Basic operators

Python Interpreter as a calculator

Variables

- No variable declaration- Defined upon assignment- Variable type and value are defined by last value assigned- Therefore type may change dynamically (thus “Dynamic Typing”)

if, elif, else

- raw_input() for getting an input string- int() casting- Note the ‘:’ in the syntax- Indentation matters (no curly brackets)- The interpreter waits for code completion with secondary prompt (‘…’) - print() and some other functions work without brackets- Note the multiple condition 0 <= x <= 9

While loop

- Again note the ‘:’ and indentation- continue & break commands like in C- Note the optional ‘while - else’

list type

- Empty list definition using [ ]- Elements may be of any type and different types in same list- Basic ops: +, *, append(), extend(), [ndx], len, in, del- range( ), range( , ) functions create lists of consecutive ints - Slicing for read or write [from : to] , [from : to : jumps]- Note the possibility of omitting one or both of the limits (from,to)- Note the [::-1] giving the entire list but in reverse order

for loop

- for <variable> in <sequence-type> :- xrange() is similar to range() but lazy, evaluates next value when requested- Note the formatted print using %d %s %f similar to C- Again note the optional ‘else’

functions

- def <func-name> (<params>):… return <ret-val>

- After defined, the function name becomes an object identifier- It may be assigned to a variable and has methods like any object

dictionary

- A dictionary is an “assosiative array”, a set of <key>:<val> pairs- Each key may be any immutable type- Values may be mutable- The empty dictionary is { }- Functions used here: chr, ord, zip- Note the “List comprehension” syntax in the assignment to values (2nd line)

{i+1:chr(ord('a‘)+i) for i in xrange(5)}Dict comprehension

classes

- Tree inherits object - __init__() is the constructor- ‘self’ is a convention name for “this” - Members defined by assignment- Default values defined with ‘=‘ (like C++) - NewTreeMain module imports Tree- Notice the check __name__ == ‘__main__’ to avoid runing imported modules

טיפים

ב • shellלהשתמשמלולאות • להימנע•list/dict comprehensionבמילונים • להשתמשבקובץ • הקוד את לשמורסביבת • שמספקת שימושים בקיצורים להשתמש

ב כמו .Idleב+? Eclipse, alt+p, altב cntrl+spaceהפיתוח

Practice - Python hands on • , המדריך את לקרוא מאוד מומלץ קצת טעמנו

פייתון של //:הרשמי . . /2/http docs python org tutorial/ •: נוספים חשובים נושאים

Exceptions, Modules & Packages, I\O with Files, variable scope, standard libs, …

התנסות • להגשה תרגיל באתר לא נמצא• : למתרגלים באימייל לשלוח מוזמנים אתם

ב, – לפרסום והמלצות הערות קהילת) FAQשאלות גישתלומדים(

• . ולהתמודד לנסות בחום מומלץ... הבאים בתרגילים לעזור עשוי הניסיון

top related