Brain DeCoded with CodeX - Mission 4, Objective 2: Pattern Recognition
Pattern Recognition
Students learn which parts of the brain find patterns, then write the algorithm that lets a CodeX do the same job on a word the user types in.
Overview
Objective 1 made the case that language runs on patterns. This objective shows students who is doing the pattern finding, first in the brain and then in code.
Students read how the visual cortex, temporal lobe, parietal lobe, hippocampus, and prefrontal cortex split the work of recognizing, remembering, and categorizing patterns. Then they build repeated_letters, a program that asks for a word on the Console and displays it on the CodeX with consecutive repeated letters in yellow and everything else in blue.
That is an algorithm, a fixed set of steps, not a neural network. Worth naming the difference out loud, because students often assume any computer that finds a pattern must be "learning." Algorithms are just the right place to start.
🎯 Project Goal: Students add code to a program that detects repeated letters.
Learning Targets
- I can identify parts of the brain used in pattern recognition.
- I can explain what an algorithm is.
Key Concepts
- Many parts of the brain work together to recognize, remember, and make sense of patterns in everything from faces to languages.
- Computers can recognize patterns using algorithms.
- Using an algorithm and neural network processing are different, but learning about algorithms is a good place to start.
Assessment Opportunities
- Turn in the Activity Guide.
- Complete the program repeated_letters.
Success Criteria
- Complete the CodeTrek steps
- Program runs correctly without errors
- Activity Guide is completed
Digital Resources
Classroom Materials
- ▸CodeX device and USB cable, one per student
- ▸Laptop/computer with Chrome browser
Extensions & Cross-Curricular
find_repeating_letters() and print_word() and explain each line. How are the two functions alike? How are they different?
🔤
Vocabulary
▾
🐍
New Python Code
▾
📐
Standards
▾
Computer Science
English Language Arts & Literacy
- Run the program yourself first, Console and all. Knowing what a finished run looks like on the CodeX makes it much faster to spot where a student's version went wrong.
- Know where the Console is before class. It is the icon below the Toolbox, and students will not find it on their own.
- Decide how students get the Activity Guide. You can print a copy for each student or assign it digitally.
- Have a few test words ready that show different results: one with a double letter, one with none, and one with two doubles.
- Look over the brain diagram in the reading. Students do better on the learning target if you can point to each region as it comes up.
- The program uses the Console for input. Students need to click the Console icon below the Toolbox. When the program runs, a prompt appears. Type the word to search and press Enter.
- Students should follow the instructions on the Activity Guide and record their results.
- The program only finds consecutive repeated letters. "letter" has one pair, "banana" has none. That surprises students, and it is a good conversation about what the algorithm was actually told to do.
- This objective is where the algorithm and neural network distinction gets made. Students tend to call anything that finds a pattern "AI," so it is worth correcting early.
- Extensions and cross-curricular projects are included to enhance the concepts in the objective. You can use the extensions to extend students' learning.
Lesson Outline
Start with how fast the brain does this.
- Ask: "You spot a friend across a crowded room in about a tenth of a second. How did your brain do that so fast?"
- Ask: "If you had to write down the exact steps for recognizing a face, what would step one be?"
Students work through the reading on brain regions and machine pattern recognition.
- Students read the section on the visual cortex and how the brain stores features as patterns.
- Walk the brain diagram: visual cortex, temporal lobe and the fusiform gyrus, parietal lobe, hippocampus, prefrontal cortex. Give each one a one-line job.
- Move to Machine Power: detecting shapes in images, finding a face in a photo, reading handwriting.
- Define algorithm as a class before anyone opens the code.
Students build repeated_letters.
- Students work through the CodeTrek steps, adding code to repeated_letters.
-
In
find_repeating_letters(), students build the empty list, compare each letter with the next one, and append the positions of any match. -
In
print_word(), students loop through the word and print each letter in yellow if its position is in the list, blue if it is not. - Students open the Console, run the program, and type a word at the prompt.
- Students test several words and record the results on the Activity Guide.
Close on the difference between an algorithm and a brain.
- Ask: "Your program found the repeated letters. Did it understand the word?"
- Ask: "Which part of what your brain does was your algorithm actually doing, and which parts did it skip?"
- Collect the Activity Guides.