Visit Paul's website
The book From Computing to
Computational Thinking
can be ordered at: computize.org
Introduction
In this article of our Computational Thinking blog (computize.org/ctblog), we will talk about patterns.
The word ‘pattern’ may mean different things to different people. But here we focus on the following. According to Wikipedia:
A pattern is a regularity in the world, in human-made design, or in abstract ideas. As such, the elements of a pattern repeat in a predictable manner.
We communicate with patterns. Reading is to remember spelling or stroke patterns in a language. Speaking is to pronounce words in prescribed sound patterns. To understand speech, we must first hear and detect the sound patterns, connecting them to words, filter words through grammar patterns, then interpret their meaning in the right context. We can even think of the context as the overarching pattern containing the words.
We also see the world through visual patterns—triangles and circles (geometric patterns), dogs and cats, trees, cars and buses, roads, traffic signs, faces, tables and chairs, and so on.
We delight in patterns—dance to beats, sing songs, listen to music, enjoy pictures and paintings, create sculptures, and make quilts.
Patterns are everywhere. In fact, we can’t live without them. Without patterns, how would we find our way home? Recognize loved ones? Tell objects apart? Diagnose health problems (symptom patterns)? Drive our cars? Or even do our jobs?
A heightened sense of patterns can be helpful in almost all situations as you will see.
Web Search Patterns
We humans are curious beings. One of the greatest joys of modern life is being able to find answers to questions instantly. Of course, we are talking about Web searches.
Using Google or another search engine, we might enter a sequence of words, “Old MacDonald Had a Farm” for example, and find out all about the song. The sequence of words given is known as a search pattern. Knowing how to use search patterns can make Web search faster, easier and more precise.
First we need to realize that when given a sequence of words, Google will look for information in its database containing those words, but not necessarily in that order or even in the same sentence. The letter case is usually ignored. Surround the words in quotation marks to insist on exact matches. For example "white paper" versus "paper white".
Even though Google is smart, it is often useful for us to provide a specific context for our search pattern. For example. using subway usually gets you locations of the restaurant. Philadelphia subway should get you public transportation in that city. The pattern Washington D.C. subway gets you info on the DC Metro in addition to restaurant locations in DC. Use -restaurant (the hyphen is a Google search operator) to remove that option. To indicate search within a website use site:computize.org recursion, for example.
Here is an example of providing good context. The search pattern
tennis 2021 Australian Open woman final highlights youtube
should lead directly to the exciting video to watch. To get more tips, search for Google Search Operators.
String Search Patterns
On the computer, text/document editor apps such as MS Word™, Excel™, Notepad++, LibreOffice (free), VI/VIM (text editor) offer many useful features including spelling help, grammar checking, text search/replace, and more.
We all know how tedious it is to look through a long document for some specific word, phrase, date, name, or some other string of characters. Luckily most text editors offer automatic search for any given string (of characters) within the document being processed.
Looking for a target string involves
(A) you specify the string to search and
(B) the computer finding matches in the document.
To specify which string to search, you use a notation known as regular expression or regex. This may sound complicated but it is really simple.
1. A regex is a string consisting of regular characters and metacharacters.
2. A regular character stands for itself, indicating the character to match.
3. A metacharacter indicates your desired options for what character to match. The usual metacharacters are {}[]()^$.|*+? and \ (the backslash).
For example, the regex hat matches just that while h[aeiou]t will match hat, het, hit, hot, and hut. Thus, the expression [xyz] matches any one of the enclosed characters, namely x, y, or z. The metacharacter * indicates zero or more repetitions of the previous character. For example, Ha* matches H, Ha, Haa, Haaa and so on. Here is an application: chapter[1-9] matches chapter1, chapter2, all the way to chapter9.
The metacharacter . (period) matches any single character. Thus, .*pdf matches pdf or anything followed by pdf. To match the character . we need to escape it (prevent its metacharacter meaning) by preceding it with \. Thus.*\.docx matches anything ending in .docx.
As you can see, regular expressions are powerful but can become complicated. For more information search for Wikipedia: regular expression.
Are You A Human
Indeed computers are fast and efficient in matching textual patterns. Much faster than humans. But image patterns are a whole another story. In fact, humans are so much better than computer systems in this direction. Actually, on the Web, image patterns are used to test if the user is a human or a bot. Such tests are known as CAPTCHAs (Completely Automated Public Turing test).They effectively prevent bots from registering for services, making comments, pretending to be customers, etc.
Most commonly one or more images are presented for the user to detect numbers, characters, cars, boats, animals in the images.
In this example, the twisty curvy characters are easy for humans to recognize, but not for bots. The extra line segments serve to further confuse any automated character recognition attempts. In the next example, a user must identify every picture, out of nine, with a bus in it.
Even just having to click inside a designated area becomes an effective CAPTCHA.
Humans and computers are built and function differently. We have full understanding of how computers work but not the human mind. Some pattern recognition tasks are easy for humans but hard for computers and vice versa.
Facial Recognition
When we see a face we easily recognize if it is a friend or stranger. However, such a simple task becomes much harder for a computer system.
Automated facial recognition systems are useful for authenticating an account holder, a ticketed passenger, a credit/debit card user, a cellphone owner, and so on. It is also useful in video surveillance and law enforcement applications.
Basically, a facial recognition system needs to isolate a face in an image (from camera or video frame), normalize the face image (to that of a passport photo for example), extract facial features (width between eyes, length of nose,etc.), then compare the features with target images to perform recognition.
Automatic facial recognition technology is well developed and relatively mature and can be applied widely. For example, faces captured from videos and pictures of the January 6 US Capital insurrection have been used by law enforcement to identify the individuals. These days, even ordinary people can use websites such as PimEyes to identify others from facial images.
Beware there are security and privacy concerns when you allow an app to collect your facial recognition information.
Hey, Let’s Talk
In the first year at MIT graduate school, I wrote a term paper on better computer user interface which basically called for talking as the desired mode of human-computer interaction. At that time (1967), we interacted with computers via typewriter-like terminals, even at MIT.
Now we are all talking to our smartphones and computers—Alexa (Amazon Echo), hello Google, hey Cortana (MS Windows 10), hey Siri (Apple), and soon. Even though we are limited to what can be said and understood by the automatic speech recognition (ASR) system, we feel happy and in control.
ASR works by recognizing sound patterns and converting them to words(text). The costly computation must be done quickly, in milliseconds, so the computer does not appear retarded. In addition to overcoming background noises, ASR must also deal with male/female/child voices and accents. Finally there are homonyms (many in English but much more in Chinese) such as ‘here’, ‘hear’; ‘two’, ‘too’. An ASR system must rely on context to make clever decisions. Still today’s ASR systems are far from understanding speech, they are programmed to simply respond to a fixed set of commands.
Self-Driving Cars
Some say the future of transportation lies in self-driving cars. Such a car is certainly an advanced piece of technology integrating sensor inputs (radar, laser,infra-red), geo-positioning, map data, and computer vision into one dynamic control system to drive safely from point A to B.
Its computer vision system must identify traffic signs and signals, vehicles, pedestrians, animals and other objects that may be on or traveling the road. That certainly is a significant task in real-time pattern recognition. The technologies are still in the developing and testing stages.
On March 2018 in Tempe Arizona, a Uber self-driving car, with test driver inside, hit and killed a woman walking at night (10 PM). The woman was pushing a bicycle across the road. According to the National Traffic Safety Board (NTSB) the cause was that the system lacks “the capability to classify an object as a pedestrian unless that object was near a crosswalk”. Putting pedestrians and other moving objects under the context of crosswalks is obviously mistaken.
On March 2019, a Tesla Model 3 with Autopilot engaged crashed into a truck, killing the driver, according to Ars Technica.
These tragic events tell us that automated driving has a good distance to go before becoming practical. Because of its huge potential, companies are still actively pursuing self-driving cars.
The AI systems in self-driving cars are being road tested extensively to gain experience in different situations, scenes, weather conditions, and objects encountered to make improvements.
Patterns in Data
Wise people learn from history and experience (known data) and find patterns for what works and what fails. These patterns can help us avoid repeating mistakes and duplicate successes.
With computing, we can collect a lot of data and find regularities (patterns) in them. Such patterns can be put to good use in specific areas. For example data of symptoms can help disease diagnosis, of traffic accidents can help road design and safety, of spam can make email filters more effective, of consumer interests can lead to more useful recommendations, and so on.
We have talked about training self-driving systems with data. Google Translate is another example. It has a huge database on existing translations among many languages and reaches into this data to do translation work. Thus, it really does not understand the material it is translating. How strangely wonderful. Google Translate also collects user feedback (more translation data) to improve its ability to translate.
A significant trend in AI is exactly in collecting and analyzing big data for improved business practices in client companies.
Finally-Computize
Recall that we defined computize as “To apply computational thinking. To view,consider, analyze, design, plan, work, and solve problems from a computational perspective.”
In computational thinking, identifying, recognizing, matching, and using patterns are important. Thus, let us apply patterns in our daily lives. For example, we can write down the pattern of a phishing email:
• The incoming email is from an unknown email address.
• The email does not address the receiver by name.
• The email promises unexpected money coming your way or talks about something urgent or important, such as your account expiring, bill overdue, resource quota exhausted.
• You are advised to follow a link or open an attachment.
Of course, you won’t be fooled and will forward such email directly tophishing-report@us-cert.gov.
Here is a more general situation. We all know that bad things happen when we are nervous, hurried, distracted, preoccupied, or absent minded. Yet we also find ourselves in such moods after something bad happens. So the pattern: one bad thing can lead to another. Knowing this pattern, we all must keep calm, cool, collected, focused, rational, and decisive to deal with a bad situation. This way we can make things better instead of worse.
How about noticing patterns when you lose your temper? forget things? become defensive/offensive? gain/lose weight? Patterns that make you productive/energetic? efficient and effective? agreeable or disagreeable? sad or happy?
These are just some examples. I am sure you can find many many useful places to apply patterns to great advantage.
Perhaps on MacDonald’s farm he finds a computer—Here a pattern, there a pattern, everywhere pattern pattern ee-i-ee-i-o!
ABOUT PAUL
A Ph.D. and faculty member from MIT, Paul Wang (王 士 弘) became a Computer Science professor (Kent State University) in 1981, and served as a Director at the Institute for Computational Mathematics at Kent from 1986 to 2011. He retired in 2012 and is now professor emeritus at Kent State University.
Paul is a leading expert in Symbolic and Algebraic Computation (SAC). He has conducted over forty research projects funded by government and industry, authored many well-regarded Computer Science textbooks, most also translated into foreign languages, and released many software tools. He received the Ohio Governor's Award for University Faculty Entrepreneurship (2001). Paul supervised 14 Ph.D. and over 26 Master-degree students.
His Ph.D. dissertation, advised by Joel Moses, was on Evaluation of Definite Integrals by Symbolic Manipulation. Paul's main research interests include Symbolic and Algebraic Computation (SAC), polynomial factoring and GCD algorithms, automatic code generation, Internet Accessible Mathematical Computation (IAMC), enabling technologies for and classroom delivery of Web-based Mathematics Education (WME), as well as parallel and distributed SAC. Paul has made significant contributions to many parts of the MAXIMA computer algebra system. See these online demos for an experience with MAXIMA.
Paul continues to work jointly with others nationally and internationally in computer science teaching and research, write textbooks, IT consult as sofpower.com, and manage his Web development company Webtong Inc.