GE143 - Human vs AI systems

Fundamentals of Machine Intelligence

Dr Robert Batzinger
Instructor Emeritus

Payap University
Chiang Mai, Thailand
17-Aug-2022

0.1 Agenda

  1. Basic programming

  2. Regression

  3. Genetic algorithms

  4. Markov states

  5. Neural nets with back propagation

  6. Self-organizing maps

1 Basic programming

Wizard vs Ogre

1.1 Basic building blocks

  • Variables: assignable memory \(\pi = 3.1415926\)
  • Operators: modify and combine variables \(+, -, \times, \div, \sqrt{\ \ }\)
  • Logic function: comparison of variables \(\lt, \le, =, \ne, \ge, \gt\)
  • Functions: process the input to calculate a corresponding output \(y=sin(x)\)
  • Input / Output: receiving and sending information to the world (via multimedia)

1.2 Process controls

  • Repeated process
x = 0
while (x < 5) {
  try(x)
  x += 1
}

x = 0
unless (x > 5) {
  try(x) "
  x += 1
}
  • Conditional processing
if(x == 5) {
   print "smiling"
} else {
   print "frown"
}

unless (x == 5) {
   print "smiling"
} else {
   print "smiling"
}

1.3 Actions

The programmer must …

  • specify the actions and nature of every actor.
  • determine what conditions must be tested and the appropriate response
  • arrange the output.

Examples

1.3.1 Basic Actors of this Program

3 Sprite objects on a backdrop

1.3.2 Actions of the Wizard

1.3.3 Actions of the Bolt of Lightning

1.3.4 Actions of the Ogre

1.3.5 Actions of the Wizard

1.4 Contrast to AI development

Programming

  • Requires a programmer who understands the problem domain
  • Algorithm is implement in code written by the programmer
  • Program logic is hard coded
  • Changing trends and procedures will require revision of the code
  • Test cases are used to demonstrate that the code is correct.

AI

  • Requires a data scientist to develop the dataset
  • The program logic are gleaned from the data
  • Behavoir changes with changes in the data
  • Outcome is verified against the data set
  • The machine learning can be from either graded data or raw data.

2 Regression

Statistical Machine Learning

2.1 Regression analysis and modelling

Year Average miles per gallon
1940 14.8
1950 13.9
1960 13.4
1970 13.5
1980 15.5
1986 18.3

2.2 Analysis

2.3 Cone of Certainty

Coefficients Estimate Std. Error t value Prob
(Intercept) 15.103654 0.536028 28.177 9.81e-05
x -0.224609 0.055097 -4.077 0.0266
x2 0.006171 0.001139 5.416 0.0123

\[ mpg = 15.103654 - 0.224609 t + 0.006171 t^2\]

2.4 Regression to forecast

2.5 Regression analysis of a data trend

3 Genetic algorithms

Process based on evolutionary biology

  1. Selection of best candidates
  2. Combinations of best solutions
  3. Crossover
  4. Mutation

3.1 Combination and crossover

3.1.1 Genetic mutation

3.2 Searching for solutions in complicated domain space

  • Most searchs are basically hill-climbing exercises to find the maximum value
  • Basically the search creates an ascent path until the peak is found
  • However, multiple peaks and valleys can hide the true solution
  • Genetic can search multiple areas simultaneously to discover the answer faster.

3.3 A multipeak problem

3.3.1 Mastermind

Mastermind Game

  • Object is to identify the sequence of 4 colors.
  • There are 8 possible colors.
  • A red mark means a color is correct but in the wrong column
  • A green mark indicate a color is correct and in the right column

4 Markov Chains

Measure the probability of transitions over a year

From To Urban To Suburban
Urban 0.95 0.05
Suburban 0.03 0.97

\[\Updownarrow\]

City dwellers

5% move
95% stay

 

Rural / Suburban dwellers

3% move
97% stay

4.1 Markov Chains

\[\begin{matrix} & & Population & Transition & & Year end\\ Year & & Urban : Rural & matrix & & Population \\ 1: & & \left[\begin{matrix}130000 & 50000\\\end{matrix}\right]& \left[\begin{matrix} 0.95 & 0.05\\ 0.07 & 0.93\\ \end{matrix}\right] & \longrightarrow & \left[\begin{matrix}127000 & 53000\\\end{matrix}\right]\\ 2: & & \left[\begin{matrix}127000& 53000\\\end{matrix}\right]& \left[\begin{matrix} 0.95 & 0.05\\ 0.07 & 0.93\\ \end{matrix}\right] & \longrightarrow & \left[\begin{matrix}124360 & 55640\\\end{matrix}\right]\\ 3: & & \left[\begin{matrix}124360& 55640\\\end{matrix}\right]& \left[\begin{matrix} 0.95 & 0.05\\ 0.07 & 0.93\\ \end{matrix}\right] & \longrightarrow & \left[\begin{matrix}122037 & 57963\\\end{matrix}\right]\\ 4: & &\left[\begin{matrix} 122037 & 57963\\\end{matrix}\right]& \left[\begin{matrix} 0.95 & 0.05\\ 0.07 & 0.93\\ \end{matrix}\right] & \longrightarrow & \left[\begin{matrix}119992& 60008\\\end{matrix}\right]\\ & & & \dots &\\ 20:& &\left[\begin{matrix}105000& 75000\\\end{matrix}\right]& \left[\begin{matrix} 0.95 & 0.05\\ 0.07 & 0.93\\ \end{matrix}\right] & \longrightarrow & \left[\begin{matrix}105000& 75000\\\end{matrix}\right]\\ \end{matrix}\]

5 Neural network

\(\left[\begin{matrix}\circ\bullet\bullet\bullet\circ &\circ\circ\bullet\circ\circ & \bullet\bullet\bullet\bullet\circ& \bullet\bullet\bullet\bullet\circ &\circ\circ\bullet\circ\bullet &\bullet\bullet\bullet\bullet\bullet\\ \bullet\circ\circ\circ\bullet &\circ\bullet\bullet\circ\circ & \circ\circ\circ\circ\bullet & \circ\circ\circ\circ\bullet &\circ\bullet\circ\circ\bullet &\bullet\circ\circ\circ\circ \\ \bullet\circ\circ\circ\bullet &\circ\circ\bullet\circ\circ &\circ\bullet\bullet\bullet\circ & \circ\bullet\bullet\bullet\circ &\bullet\bullet\bullet\bullet\bullet &\bullet\bullet\bullet\bullet\circ\\ \bullet\circ\circ\circ\bullet &\circ\circ\bullet\circ\circ & \bullet\circ\circ\circ\circ & \circ\circ\circ\circ\bullet &\circ\circ\circ\circ\bullet &\circ\circ\circ\circ\bullet\\ \circ\bullet\bullet\bullet\circ &\circ\bullet\bullet\bullet\circ&\bullet\bullet\bullet\bullet\bullet& \bullet\bullet\bullet\bullet\circ &\circ\circ\circ\circ\bullet &\bullet\bullet\bullet\bullet\circ\\ & & & & &\\ \circ\circ\circ\bullet\circ &\bullet\bullet\bullet\bullet\bullet & \circ\bullet\bullet\bullet\circ& \circ\bullet\bullet\bullet\circ &\circ\circ\circ\circ\circ& \circ\circ\circ\circ\circ\\ \circ\circ\bullet\circ\circ & \circ\circ\circ\circ\bullet &\bullet\circ\circ\circ\bullet & \bullet\circ\circ\circ\bullet&\circ\circ\circ\circ\circ & \circ\circ\circ\circ\circ \\ \circ\bullet\bullet\bullet\circ & \circ\circ\circ\bullet\circ & \circ\bullet\bullet\bullet\bullet & \circ\bullet\bullet\bullet\circ &\bullet\bullet\bullet\bullet\bullet& \circ\circ\circ\circ\circ\\ \bullet\circ\circ\circ\bullet & \circ\circ\bullet\circ\circ & \circ\circ\circ\circ\bullet & \bullet\circ\circ\circ\bullet&\circ\circ\circ\circ\circ & \circ\bullet\bullet\circ\circ\\ \circ\bullet\bullet\bullet\circ & \circ\circ\bullet\circ\circ & \circ\circ\circ\circ\bullet & \circ\bullet\bullet\bullet\circ &\circ\circ\circ\circ\circ & \circ\bullet\bullet\circ\circ\\ \end{matrix}\right]\Longrightarrow\left[\begin{matrix}0\\ 1\\ 2\\ 3\\ 4\\ 5\\ 6\\ 7\\ 8\\ 9\\ -\\ .\\ \end{matrix}\right]\)

5.1 Digital Neuron

5.2 NeuralNet

5.3 Network Learning

6 Self-organizing map

6.1 SOM Examples

6.2 Usefulness of SOM

  • Self-learning algorithm
  • Clusters data into useful groups
  • Compares new data to the nearest groups
  • Useful for an initial analysis of unprocessed data
  • Attempts to group items by similarity

7 Spell checking sample

Eye halve a spelling checker It came with my pea sea. It plainly marks four my revue miss steaks eye kin knot sea. Eye strike a quay and type a word and weight for it to say Weather eye yam wrong oar write. It shows me strait a weigh as soon as a mist ache is maid. It nose bee fore two long and eye can put the error rite. Its rare lea ever wrong. Eye have run this poem threw it, I am shore your pleased to no. Its letter perfect awl the way. My checker told me sew.

7.1 Grammerly corrected

Eye halve a spelling checker It came with my pea sea. It marks four my revue miss steaks eye kin knot sea. Eye strike a quay and type a word and weight for it to say Weather eye yam wrong oar write. It shows me straight a weight as soon as a mist ache is made. It nose bee fore two long and eye can put the error rite. It’s rare lea ever wrong. Eye have run this poem threw it, I shore your pleased to no. Its letter is perfect awl the way. My checker told me to sew.

7.2 MS Word corrected

Eyes halve a spelling checker It came with my pea sea. It plainly marks four my revue misses steaks eye kin knot sea. Eye strike a quay and type a word and weight for it to say Weather eye yam wrong or write. It shows me straight a weigh as soon as a mist ache is a maid. It noses bee fore two long and eye can put the error rite. It’s rare lea ever wrong. Eye have run this poem threw it, I shore your pleased to no. Its letter is perfect all the way. My checker told me to sew.

7.3 Manual proof-copy

I have a spelling checker It came with my PC. It plainly marks for my review mistakes I cannot see. I strike a key and type a word and wait for it to say whether I am wrong or right. It shows me straight away as soon as a mistake is made. It knows before too long and I can put the error right. It’s rarely ever wrong. I have run this poem threw it, I am sure you’re pleased to know it’s letter perfect all the way. My checker told me so.

7.4 Results

Method Changes Corrections
Grammerly free edition 10 8
MS WORD 360 13 10
Manual Copy editing 38 38

8 FACIAL RECOGNITION

Dog-muffin challenge

8.1 State of the art

Current uses of facial recognition

  • Attendance tracking
  • Personal marketing
  • Banking id, fraud detection
  • Public security
  • Door locks

8.2 Detection avoidance

textured masks Face Recog

Printed clothing