Tackling Machine Learning and AI at the Annual Hour of Code

This Monday, the MICDS Programming Club invited Upper School students, faculty, and staff to participate in the annual Hour of Code. What is Hour of Code? It’s exactly what it sounds like! Attendees are given an hour to practice whatever coding challenge they’d like to take on. All programming abilities are always welcome, so the event can be a great introduction to coding for those just beginning to dabble in code, but it also has a range of intermediate and more advanced opportunities.

For more information about Hour of Code, check out this introductory video by Lucas McCarty ’21, MICDS Programming Club Co-Head:

McCarty remembers the first time he participated in Hour of Code: “Hour of code is an amazing event that actually takes place each year, not only at MICDS but also at schools across the country. I still remember when I attended the high school programming club’s event for the first time as a freshman. It was such a great experience to learn from and work with others also interested in programming. Now as a senior, I am one of the ones leading the event. This year, I was impressed by our members’ willingness to challenge themselves with a lesson on machine learning. I cannot wait to see what they accomplish in the next few years to come.”

This week, the event was conducted virtually over Zoom. In typical times, participants meet together in Programming Club Sponsor Janet Purdy’s classroom with food and a variety of programming stations and games. To convert this to the virtual format, eight breakout room options were made available over Zoom with different coding activities ranging from beginner to intermediate-experienced.

Hour of Code Activities:

  • Block-based programming – Drag and drop a series of blocks which execute different commands in order to create a simple program
  • Introduction to Python and/or Java – This is a lesson that teaches the fundamental aspects of computer programming in Java and/or Python. Learn about loops, if statements, and variables.
  • Create a Calculator – Program a text-based calculator where the user inputs two numbers, then gives an operator (+,-,/-*), and the program returns the correct answer.
  • Number-Guessing Game – Program a number guessing game where your game automatically generates a random number between 0 and 100. Continue to ask the user for a guess until they get the number right, while letting them know if they are too high, too low, or correct along the way.
  • Create a Picture – Modify the code to program your own picture out of basic shapes. (Examples: train, Pacman, chair)
  • Create a Song – Program yourself a little song as you learn how to make beeps via python at different frequencies.
  • Discussion of Machine Learning and AI – Learn exactly how AI works by taking a look at a perceptron.
  • Convert a Board Game into Code – Take a board game you like and convert it into code. Generate a GUI as well if you’re up for it.

Upon selecting an activity, attendees are encouraged to work together, ask questions to the Programming Club members along the way, and have fun!

This year’s attendees decided to stick together and discuss machine learning and AI (artificial intelligence). They dove into concepts such as derivatives, perceptrons, and how to train their machines (computers) to learn patterns. They played with functions of inputs, weights, and outputs.

McCarty explained one application of this in the world of robotics. Robots (machines) have sensors that use their training to predict whether or not they have crashed. Did they brush up against something or crash into a wall? From running through training, their sensors should be able to predict the answer to that question.

The coding group worked on this concept through a set of data in columns and rows. First, they’d decide on the statement like “if there’s a 1 in the first column, then the output is true.” After several rows of data for training, a new row was given where the machine had to guess the result. The machine strives to detect patterns based on its training with the various inputs.

Next, the group reviewed a diagram of a perceptron that showcased inputs, synapses (weights), neurons, and outputs. Here, the attendees asked, “How do we get the weight numbers to be correct?” They learned that the machine adjusts the weights while determining the pattern. “Training is the process of refining the weight number,” McCarty explained. “When we have the right weight numbers, we know what the pattern is.”

To the delight of the group, even Head of School Mr. Rainey popped into the Hour of Code meeting. Rainey observed, “The extent to which some of our students already grasp the fundamentals of artificial intelligence algorithms was amazing to me! During the discussion, one student remarked that TensorFlow, a software library that enables machine learning, was ‘developed by people much smarter than anyone in this room.’ While the comment was made more in a spirit of reverence for TensorFlow’s creators than of dismissiveness toward our Hour of Code participants, I was quick to observe to the group that intelligence matters, of course, but that hard work and perseverance matter just as much. I am certain that the architects of TensorFlow encountered many obstacles and failures as they endeavored to realize their vision. Later, in reflecting on my visit to the Hour of Code gathering, I remembered the advice that the musician Woody Guthrie once gave to himself: ‘Write a song every day.’ So, to you Hour of Code enthusiasts and all other budding software and AI enthusiasts at MICDS, I would adapt the same advice for you: ‘Write some code every day.’ There is no substitute for hard work and perseverance.”

Whether you’re brand new to coding or an expert, a student or a faculty/staff member, remotely or extremely interested in coding, it’s safe to say that the Hour of Code has something for everyone to learn and discover. Great job to Lucas McCarty and the entire Programming Club on a successful virtual 2020 Hour of Code!