Uploaded by Cecelia Youso

Fundamentals of Artificial Intelligence

advertisement
Module 1: Programming, Programming vs. AI
Inputs > Storage & Processing Information> Output
How do we define information in this context? Information is any valuable data (ex: symbols,
videos, images, text, numbers)
Binary Numbers 0 or 1
Binary is the simplest way to represent data, and it represents all data on computers - from text
to images to videos to graphics, including sound
8 bits = 1 byte
Data Representation
Each letter has a symbol in the ASCII table
abstraction: simplification, extracting what’s relevant out of a large data set, makes
programming more efficient by only using what we need and leaving out the rest.
Circuits
Simple circuit
- takes an electric signal and flips it: 0 > 1 or 1 > 0
- not” circuit since the input isn’t the same as the output
Complicated circuits
- Can take multiple signals and combine them to give different results
- And:
01>0
11>1
Adder
- Add together two bits and give the results as an output
- Put circuits side-by-side to add together much larger numbers
Basics of Programming
Syntax: the rules in a programming language that define what the symbols mean. The syntax
tells the computer how to read the code.
The goal of programming is to learn how to formulate problems so that we can solve them
through computation.
Computers only understand what we are telling them. Instructions need to be very specific, and
order matters!
Why are there so many programming languages? Each comes with its own strengths and
weaknesses.
Definitions in Programming
Statement
- Building blocks of your program
- Represent actions in lines of code
- Expressions, operators, and Keywords
Expression
- Combination of operators and operands that will create or break down to a single value
- EX: 0 + 2 = 12, where 0 + 2 is the expression and 12 is the value of the expression
Operators
- Symbols with special meanings that perform computation
- EX: = + - / *
Operands
- Represents the data to be manipulated
Keywords
- Reserved words used for a special purpose
- Cannot be used as a variable name
- EX: break, continue, if, else, elseif, end, while, for, switch, return, function
Variable
- A named object that stores data or any information
- Can be a combination of letters, numbers, and underscores
- Name should start with a letter
- ‘A’ and ‘a’ are two different variables – case-sensitivity matters
Types of variables
- Integer: whole number
- Float: decimal numbers and fractions
- Character: b
- String: “hello world”
- Boolean: breaks down to either true or false, conditional expression
Conditionals
- If/else statements
Loops
- Useful for repeating tasks
- Loops execute a block for code until a condition is reached
- While loops will execute block of code as long as the condition is true
While (condition):
Statements
End
- Use For loops when you know how many times you want to execute the block of code
For x in range(1,10001)
print(x)
Programming vs. AI
AI is a branch of computer science to get computers to do intelligent tasks
Programming is following instructions, rigid rules, logic is added to code so the program does
exactly what it’s supposed to do
Programming: Input + Code = Output
AI includes programming, but it also includes other disciplines.
- Enter the data set to feed in all of this data to the model
- Store the values into variables
- Give a command and the computer will predict the value of the function based on the
data that’s been given to it
AI: Input + Output >>> Code
Download