Module 2: How do computers build intelligence?


image of computers transferring information

Module 2 – High School

This module covers how computers are programmed to be intelligent, how sensors and data can make computers more intelligent, and how computers learn to be intelligent using data.

Part 1 – How are computers programmed to be intelligent?

 Researchers and Scientists would like to make a computer think like a human brain. This is called Artificial General Intelligence (AGI). The human brain is incredibly complex – it can recognize patterns, learn new information, and make rational decisions. Scientists try to make computers intelligent by mimicking some of the ways the human brain works. Right now, it is not possible for a computer to think in all the ways that humans do. Computers we consider intelligent have Artificial Narrow Intelligence (ANI), which means they are generally very good at one job or way of thinking.

One way to make computers intelligent by programming is by giving computers data and rules about how to understand that data. For example, a computer may be given thousands of photos of cars. It analyzes the photos for patterns about what makes up a car – wheels, windows, headlights. Using this data, it builds a model in its programming to recognize cars in new photos.

Another way is machine learning. The computer is given a task like playing a game. Its programming allows it to analyze data from each play, learn from its mistakes, and try different strategies. By playing over and over, the computer builds knowledge to play better.

Natural language processing also trains computers to understand and generate human language. Scientists feed the computer massive texts and conversations to analyze the patterns. This allows the computer to translate languages, answer questions, and even chat!

While computers can be very intelligent at specific tasks, they don’t have true human intelligence. A computer programmed to play chess cannot suddenly decide to play checkers. It only knows what it is programmed to do. The brain uses intuition, emotion, and reasoning in ways that technology cannot replicate. Still, advanced programming enables computers to be incredibly helpful in our lives!

What are Algorithms and Programs?

An algorithm is like a set of step-by-step instructions that a computer follows to accomplish a task. It’s kind of like a recipe that a computer uses to solve a problem or do calculations.

For example, let’s think about the steps to make a peanut butter and jelly sandwich:

  1. Get out two slices of bread, a knife, peanut butter, and jelly
  2. Open the peanut butter jar and jelly jar
  3. Use the knife to spread peanut butter on one slice of bread
  4. Use the knife to spread jelly on the other slice of bread
  5. Put the two slices of bread together so the peanut butter and jelly touch each other

Those were the algorithms – the specific instructions – for making a peanut butter and jelly sandwich. Computers use algorithms for everything they do, even more complex tasks like delivering web pages, processing video, or playing chess.

The program is the “book of instructions,” or the recipes or instructions that the computer needs to do all kinds of tasks.

Programmers write out algorithms using programming languages like Python and Java that a computer can understand. The computer follows the program code line-by-line, just like following a recipe. Changing the algorithm allows programmers to get computers to do all kinds of useful things!

Example of how programming can make something intelligent
Image of Mars Rover

Algorithms are In 2020, NASA held a contest for humans to help improve the intelligence of the Mars Rover. The Mars Rover has 19 cameras to help it “see” on Mars and not run into debris or fall off cliffs. Read this article from NASA on the project.

Now answer these questions for Part 1, which you upload for your Part 1 work.

How does programming build intelligence? 

Part 2 – Can Algorithms be Intelligent?

At first, algorithms seem like they simply follow programmed steps and can’t be intelligent themselves. However, some special kinds of algorithms called “machine learning algorithms” can appear intelligent in certain ways.

Machine learning algorithms are programmed to analyze large amounts of data to recognize patterns and make predictions. For example, a machine learning algorithm could analyze thousands of cat and dog photos to learn how to recognize cats versus dogs in new photos. The Mars Rover you just read about is trying to build out an algorithm that can recognize different kinds of land formations in images taken by the rover so it can go and explore them if told by humans to do so.

By learning from data, algorithms can do things like identify objects in photos, understand speech, make recommendations, and more. The algorithms appear to demonstrate some elements of intelligence, like being able to perceive information and make logical decisions.

However, at their core, machine learning algorithms are still limited to their programming and the data they are given. They don’t have true human intelligence or general knowledge. These algorithms are specialized for narrow tasks and don’t have conscious understanding or reasoning abilities.

So, in summary – while some sophisticated algorithms may seem somewhat intelligent by being able to learn and make predictions, they are fundamentally different from human intelligence. They don’t have sentience or true thinking capabilities like humans do. However machine learning does enable computers to mimic certain aspects of intelligence in useful ways.

Other applications of Intelligent AI Computers

Machine learning uses the data in an autonomous (does not need humans) system that learn by the data and adapts to the data in new ways. Intelligent algorithms govern the recommendation system of Spotify and Instagram and the success of Netflix, which uses them to recommend movies. 

As the number of connected devices like phones and tablets that generate data increases, smart algorithms are increasing also. Companies like Amazon use them to recommend products but also to move and locate products where there is high demand. Uber and Lyft use them to create better recommendations to match drivers and travelers and to recommend the best route to take to get there.

Self-driving vehicles like cars and rovers are another use of AI. These cars and rovers can use many kinds of sensors that take in data and can make the vehicle respond to the data to make a decision.  Watch the video below about how self-driving cars work and specifically some of the sensors and devices that collect data that computers can use to make them smart. Remember the video; you will use the information to answer Part 2’s questions.

Watch this video and collect information about the sensors and devices that collect and use data.

You will now watch the video below about the sensors used in cars for the first 4 minutes. This video is used to train people who work on these “intelligent cars.” The video is not very exciting or high-tech, but it presents some important information you will need later on, specifically for a device called a thermistor, which is used to monitor the temperature of the computers and critical components in a spacecraft. For more on this, see this link about how they are used by the Ulysses spacecraft.

Watch for the first four minutes and collect information on the Thermistor.

 

Now, answer these questions for part 2, which you upload for your Part 2 work.


Can Algorithms be Intelligent

Part 3 – Programming an Intelligent Mars Rover using Python

For this part, you will get started with Python or Jupyter to create a rover that follows a path on Mars. In the game, you have to drive your Mars Rover without hitting obstacles. You will need to create a working game and be able to submit a copy of your code to the Qualtrics upload portal. We will give you shell code (coding example to work with), and you will need to change up the program to make the rover do some other pathways.

First, read this article on how the Mars Rover used the labeled data to become self-driving.

Then, you will create a working game using the Python turtle programming environment.  For more on Python Turtle, see this link and also watch this video below.

 

Video on How to program the turtle using Anaconda by Dr. R

Dropbox/Google Drive with the files. 

Dropbox

Google Drive

 

The text for the code

# Object-oriented turtle graphics
import turtle as t

# This brings in the turtle program. If you want to call a turtle command, you can just use the letter t.

# Avoids unnecessary errors from closing the Canvas
# This is a command that helps the program not have errors in the notebook.
t.TurtleScreen._RUNNING = True

# This allows us to call turtle commands by just using the letter r rather than t.turtle(command)
r = t.Turtle()

# Set screen size and background image
r.screen.screensize(400,400)
r.screen.bgpic(“mars2.png”)

# Make the turtle shaped like the rover
r.screen.register_shape(“rover2.gif”)
r.shape(“rover2.gif”)
r.speed(1)

# initialize the rover; this makes a line to track the path
# The line is red
# The size of the line is 4
# This picks the pen up, moves the rover to the bottom right corner to start and then drops the pen
r.color(“#810000”)
r.pensize(4)
r.penup()
r.goto(-350,-225)
r.pendown()

#Implement Rover Path.
# Here, we will just move the rover forward 700 steps, left 90 degrees, and forward for 500 steps
r.forward(700)
r.left(90)
r.forward(500)

Images you will use in your program. (click to enlarge)

Mars rover image

What the code looks like in the notebook (click to enlarge)

the python code in the notebook
You will run this code and see if it draws half of your box.

For each of the tasks, you will modify the code to make it run. Refer to the video by Dr. R when you need help. When you get it to work, take a screenshot of the code and the screen with the Mars map and rover and copy and paste it into a Word document. Explain what you did and what issues you had to get it to work. Repeat for each task.

Here is an example – Part 3 example Task 1

image of rover making a squre

Task 1- Run the program and then make a box using the program. Take a screenshot of the code and image as described in the video.

Task 2 Rewrite the program and then make a sweeping pattern using the program. Take a screenshot of the code and image as described in the video.

rover making a spiral pattern to the center

Task 3 Rewrite the program and then make a spiral pattern using the program and wind up at the crater in the image. Take a screenshot of the code and image as described in the video.

Upload your work for parts 1, 2, and 3 here.