Computational Thinking Initiative
|
Computational Adventures

Computer, What Is That Color?

Make a simple artificial intelligence that will classify a color based on how close it is to a subset of named colors.​
​ ​
Appropriate for ages 13+.​
​ ​
Allow 60 minutes to complete the module.
​
Important note: This module should be led by an instructor with basic Wolfram Language knowledge. If you would like to learn the language, please try this free online introduction. If you would like a Computational Thinking Initiative ambassador or volunteer to help you run an adventure, please contact us.
Learning Objective
◼
  • Students will be able to build a classifier that identifies colors.
  • Computational Thinking Principles and Practices
    ◼
  • Interpreting a problem or idea in such a way that a computer can assist with it
  • ◼
  • Treating the computer’s “misunderstandings” as proxies for one’s own
  • ◼
  • Simulating things that are hard or impossible to do by performing real-world experiments
  • Standards Alignment
    ◼
  • AP Computer Science Principles:
  • ◼
  • EK 5.1.1B: programs developed for creative expression, to satisfy personal curiosity or to create new knowledge may have visual, audible or tactile inputs and outputs
  • ◼
  • EK 5.1.2C: incrementally adding tested program segments to correct working programs helps create large correct programs
  • Helpful Background
    ◼
  • Information on color space: https://en.wikipedia.org/wiki/Color_space
  • ​

    STARTING POINT

    “Have you ever disagreed with someone about the name of a color? For example, would you call this color purple or pink?”
    In[1]:=
    Image@RGBColor[.7,.2,.5]
    Out[1]=
    Run the code above and then expand the size of the image so students can see the color when projected. Based on your projector, you may need to adjust the values of the color so that it falls more between purple and pink. Aim for a color that is hard for the class to identify.
    All throughout this activity, you may want to include Image in your code as you project for students to see your work easily.
    “How many of you think this is purple? How many of you think this is pink? How many of you are not sure?”
    Take a survey of the class and list a tally of the groups on the board (i.e. the number of students that think the color is purple, pink or cannot decide).
    “Today we are going to build an artificial intelligence that will analyze this color and decide what it should be called. The Wolfram Language includes symbols that represent common colors.”
    Direct students to the Documentation Center guide page for colors (http://reference.wolfram.com/language/guide/Colors.html) and show them the list of named colors.
    In[2]:=
    Red
    Out[2]=
    “All of the named colors are given RGB values.”
    Hover over the color above to show the RGB value. If needed, explain RGB to the class.
    In[3]:=
    RGBColor[1,0,0]
    Out[3]=
    “We can use RBGColor to make other colors that we can name. For instance, Purple is a mixture of a little Red and a little Blue.”
    In[4]:=
    RGBColor[.5,0,.5]
    Out[4]=
    “The artificial intelligence we build today will look at a random color and determine which of the named colors the random color is nearest to. It’s actually pretty simple.”