• Skip to main content
  • Skip to footer

DrTechniko

Train Young Innovators Anywhere Anytime

  • Free Stories & Activities
  • Online Courses
  • Coaching & Workshops
  • Bio
  • Blog

class

April 6, 2024 By drtechniko

How To Train Your AI

Last week I was invited to teach a group of 9th graders on the topic of AI. There is a general concern in schools that kids avoid learning by using a GPT [OpenAI, Gemini, Copilot, etc.] to do their homework. But in my opinion, given that AI is now readily available more than ever, we should adjust how we engage the students and what assignments we give them. AI is a tool they should not shy away from. Or they will fall behind. But, they should also have the wisdom to know how to use it. Or they will not grow. So, instead of telling them what to do, I showed them the real deal so they can make their own conclusions. We built an AI together as I told them a story. I hope my account of this lesson helps school teachers come up with ideas for their own classrooms.

To engage the students, I picked "movies and tv shows" as my story theme. I considered several other candidates: from making soccer predictions to personalized shopping but I felt that movies are a great way to engage both boys and girls in middle school and early high school. Besides, I used to work at Netflix 🙂

The fictional story was simple: "I have a bunch of movies that I watched, some of them I liked and some I didn't. I want to build an AI to tell me which movies I will like next. And because I'm lazy, I will ask an AI to help me build my AI! And then I will tell you how that AI got me in trouble."

It's all about data

First, I introduced myself to the kids to give them some clues: where I grew up, where I lived, what I did for work, etc.

Then I asked them to guess my preferences.

They guessed all the movies correctly except "Mamma Mia!". They thought that since I grew up in Greece I would have liked it. (Sorry, kids. I like my beach and tzatziki without the love drama.)

Then I showed them how I organized all this into data I could feed into the Movie AI using a spreadsheet.

I explained to the students that in order for the AI to decide what types of movies I like we need to tell the AI more information about each movie. We create what we call "features" to organize the information. For example "Is the movie animated?" or "is it high budget"? One of the students asked me "how do you tell if it's a high budget movie?". Good question. It gave me the chance to explain that, as the designer of the AI, I got to choose how to define that. In my case, I decided to call it "high budget" if it cost more than $100M to make. I also need to "label" each movie with "like" (check the box) or "dislike" (uncheck the box). For the computer this means like = 1 and dislike = 0.

Making the AI

Then I exposed them to the real code I wrote together with the GPT AI!

Why did I decide to torture the poor students with complex python code? I just wanted them to see how real engineers work. I explained to them that they didn't need to understand the code. I would just explain the high level idea and then run it together.

But by showing them the code, I also had a hidden agenda...

The GPT AI that I used to generate the initial code for the project made a critical error. It literally generated code that reversed my labels: 1's for the movies I don't like and 0's for the ones I liked. So I removed that "dangerous" piece of code.

It also generated code that trained the model only once, without performing proper Cross Validation, which is not a best practice in general. I let that slide however. It wasn't a big deal for the demonstration.

But it gave me the opportunity to explain to the students that if I didn't know how the code worked and I trusted the AI 100% then I would be in a lot of trouble. Maybe not for movies, but what if I trained an AI used in an autonomous car and then the car crashed??

After this, we trained the model and I showed them how training an AI is basically trying to position a line in such a way that it splits my "likes" from "dislikes" the best way possible by reducing the error of its guesses. That's why I had to train it for 1000 epochs to get there.

I showed them this graph:

At the end, I asked them to guess what my AI was. Was it a smart robot? A sentient being? A digital brain? The Matrix? The students had no clue. So I told them it was nothing this fancy. It was just a bunch of numbers that can help me draw a line to divide my data into two groups. We call them weights and biases.

Something like that:

Having fun with the AI

After we trained the AI together we saw how well it predicted these new movies:

Pretty good!

So then I asked the students to hack my AI. How would we do that? By hacking my data of course!

So here is what they did:

After "uncheck Ready Player One" and "check Barbie", etc. they figured to just simply reverse my labels (as shown at the bottom of my list).

Smart hackers!

And after we retrained the AI we got this:

Naruto was the only one who (barely) survived. He is a persistent little ninja after all!

Next Steps

After the class, I worked with the school teacher on follow-up assignment ideas. Here are some:

  • Create a new data set that has a similar format to the Movies one where you have to make one of two choices. For example, sports. For soccer you can train an AI for a goalie: "Should I dive LEFT or RIGHT?" based on data from opponent shots where the features are "isRightFooted", "runsFast", "wideAngleLeft", etc?
    • The kids then can discuss their data sets with the teacher. They can talk about how to reduce bias in their data or how they could collect and label them.
  • Try to play with the code and relabel and retrain the model to see where the AI gets confused and see if you can add extra movie features in the Feature list (or more movies).

Reference Materials

If you need to recreate this experience in your class or you want to have a conversation with your child here are the materials I used:

  • Presentation
  • Spreadsheet with Data
  • Code on Google Colab

I hope we learned something useful today,

Filed Under: artificial intelligence, class, computer science, education, programming, technology Tagged With: artificial intelligence, education, technology

April 19, 2016 By drtechniko

Teaching the “How To Build A Simple Computer Out Of Anything” activity

Here are some guidelines for making the most out of the How To Build A Simple Computer Out Of Anything activity.

The idea of this activity is to teach kids that computers do not need to be these complex unfathomable machines. Computing and computational thinking happens everywhere. When you engage with the kids in this activity make sure you remind them of that.

Motivate them

Randomness and probability are such fundamental mathematical concepts that your kids will be exposed to them no matter what they study in life. The applications of random number generation in computing are endless. It is the basis of computer security, fault-tolerance, distributed systems, and more. Not to mention exotic areas like quantum computing, DNA sequencing and self-driving cars.

Give them examples of applications to keep them motivated. Especially stuff they interact with on a regular basis. One thing I tried with my son (who was five at the time) was to get him to generate 4 digits so he can set the passcode on his mom’s iPad and have her try to break the code. The fact that he had a secret in his head that was so powerful made him ecstatic! (Of course, I gave his mom the code and told her to pretend she didn’t know.)

Explaining randomness

Randomness is better explained in the context of a real application. You want to get the kids thinking along the lines of something like: “Imagine you are making a secret number for a combination lock or your iPad so a thief can’t open it. If the thief watched your computer doing work but didn’t see the numbers that came out, would he be able to guess the numbers if he repeated what you did?”

After they do the activity for a while and if you feel the kids are advanced enough, you may follow with questions about the quality of the random numbers. Are they truly random (well-distributed)? Can a “thief” easily guess them if he ran the computer a few times and picked the most popular outputs?

No computing in their heads

One thing that will likely happen is the kids will come up with a design where the random number is created by their own decision. That’s “cheating” so to speak. For example, their design might be to flip a card from a set of cards laid out on the table. They select the card, flip it and write down the number on the card. This is not a good design because they chose (in their head) which card to flip. So, keep reminding them that they can’t “choose” by themselves. The computer has to “choose”. A good design will involve actions that create entropy like mixing a bunch of things, throwing stuff in the air, or pushing or smashing something.

Help but don’t interfere

I’ve seen kids do all kinds of designs. From throwing a bouncy ball around the house to elaborate arts-and-crafts projects like a fully colored wheel-of-fortune. As long as the kids don’t compute the random numbers in their heads, let them be creative. The more they enjoy building and using their computer the more engaged they’ll be. Don’t hesitate to give them ideas to make their computers more “extravagant”.

More designs to play with

After the kids have designed their own, a great follow up exercise is to give them the “computing” materials first and then ask them to design a random-number generating computer using only the provided materials.

Here are some ideas on how to build a computer using only:

  • A bouncy ball.
    • How: drop it in the air and count how many times it bounces.
  • A long string.
    • How: drop it in the air. When it lands, count the number of times it crosses with itself.
  • A measuring tape with any of the above.
    • Measure distance travelled, length, width etc.

Share!

Use your phone and post pictures of your kid’s designs to the DrTechniko Facebook Page. I will personally respond to your posts.

Also, don’t hesitate to send me a personal message via the Facebook page if you need help.

I hope we learned something useful today,

DrTechniko

 

Filed Under: algorithms, class, computer science, computing, design, technology

December 13, 2015 By drtechniko

How To Build A Simple Computer Out Of Anything

What is a computer?

A while ago I taught a group of 1st graders a class about computing. I wanted them to understand the concept of a computer in a simple and tangible way. So I came up with an activity where the kids would be able to build and test a simple computer anywhere: in the classroom, at home or at the playground.

Here is what I told them to do:

“Build a computer that can produce random numbers using anything you have at home.”

They go: “Really? We can use anything we like?”

And I go: “Yes. Anything you like. Except of course your mom’s or your dad’s computer. You can’t use a computer to build a computer. That would be cheating. You are also not allowed to generate the random numbers in your head. The computer must do that.”

And then they go: “What are random numbers?”

It took me a few cycles to recover from such a disarming question. I thought “Wow, the world around us is full of randomness (especially the computing world) yet how does one explain it to a six year-old?”

I said: “It’s numbers that are not in order. They are completely mixed up and you can’t guess which number comes next. Like when you throw a dice. Can you guess which number will come up when you throw a dice? No, right? That’s a random number.”

Solutions as surprising as a random number

The kids surprised me with their creativity. Here are some of their cool “computer” designs:

domarien-prng
Spin the wheel to get the next number. I love the added touch of fake buttons to make this look like a real computer!

Riley_s_random_number_computer__-_nikos_michalakis_gmail_com_-_Gmail
Stir the pot to shake the numbers and open it to pick the next one. Computing in the kitchen!

isabel-prng
Throw the dart-marker at the target and write down the number closest to the mark. I would have never thought of that one!

Surprised yet again

What’s more surprising than the creativity of the children is the lack of creativity of the adults. Having already seen what the kids came up with, I posed the same question when I interviewed a series of college students for a software engineering position. They were about to graduate from one of the top computer science programs in the US.

I asked the candidates:

“Design a computer for generating random numbers using anything found in this interview room.”

9 out of 10 of them gave me the same answer:

“I can do this by flipping a coin.”

And then I thought: “Should I tell them a 6 year-old can do better than that?”

What’s your design?

Does you kid have a cool design? Post a picture to the DrTechniko Facebook Page. I will personally respond to you.

I hope we learned something useful today,

DrTechniko

Filed Under: child, class, computer science, design Tagged With: children, education, first grade, teaching, technology

July 9, 2014 By drtechniko

Teaching the “How To Train Your Robot To Jump” game

How To Train Your Robot To Jump is a very simple game. On purpose.

The point of the game is to teach one simple concept: automation. Not how to write a program to solve a problem, but rather what a program is: a recipe for an automated task. The child uses symbols to express a “mechanical” output. Mom or dad are not jumping until he or she has positioned all the arrows. It is the simplest notion of programming I could think of.

Why not something else?

To figure out how this compared with other available options, I exposed my 2.5 year-old son to iPad apps like Daisy the Dinosaur, but the features were too advanced for him. Toddlers can’t actually read words like “jump” and “roll” so I had to do all the work. He just wanted to press the “play” button. However, if the app developers modified their UI with symbols instead of words, he might have understood what to do. Even then, though, I don’t think I’d have the same connection and fun with him as with jumping up and down together.

I also had my son try to “program in order to solve a problem” using the Angry Birds programming app. There were too many distractions for him. There are too many UI components plus he doesn’t understand what a step or turn signifies and why it’s needed. He just wanted to have the bird move straight to the piggy. Same with Robot Turtles. There were too many moving pieces (i.e., distractions). All these are great options for later, though.

One project where I think the use of technology simplifies the experience for toddlers is Bo & Yana’s robot kit, which I’ve pre-ordered and can’t wait to try with him.

Running the game

In terms of the materials for the game, you need paper, markers and scissors to do some arts and crafts and create arrows like this:

image01 

This is a fun time for the child to work with you to build the arrows. It gives you the chance to talk about what the arrows mean during the game while you make them. Be as creative as you like during this step and build some fancy arrows.

In terms of playing, have the child arrange arrows in sequence like so:

image00

and tell them that if an arrow is pointing up you will jump and if it’s pointing down you will drop (or do a push-up etc.). You should start with a single arrow and add more soon after. We made 4 arrows and we could have used more.

The arrow placement will most likely not be so orderly. That’s OK. Keep the game a low-barrier-to-entry experience for the child. Don’t fixate on having the arrows ordered. Just point to a sequence you are going to do and then do the “workout”. You can also tell them that you want to jump up 3 times and let them figure out how to place the arrows (if you want to engage into light problem solving). Also, it’s possible that they will want you to arrange the arrows and that they do the jumping. This is the perfect hook for them to learn to interpret the “program”. Have them do some jumping, then alternate. The whole game won’t last more than 10-15 minutes.

And feel free to use other symbols for doing new moves or prefix the symbols with numbers to show the effect of counting. When we played the game multiple stuffed animals and dinosaurs were involved 🙂

I hope we learned something useful today,

DrTechniko

 

Filed Under: child, class, computer science, education, programming

February 4, 2014 By drtechniko

How To Train Your Robot To Jump

Can we get a toddler to program?

Experiments in Programming with a 2-year-old

To answer that question I wanted to figure out if my son could “write” a simple program by manipulating symbols. In the spirit of my How To Train Your Robot game, I decided our contract was going to be “If you show me symbol X, I’m going to jump. If you show me symbol Y I’m going to lift my arms.”

The “symbols” ranged from Lego bricks to toys to stuffed animals.

We tried this when he was around 2 years old. It didn’t work. He was more interested in the physical object that represented the symbol rather than the meaning of the symbol in our “game”. I don’t think it had to do with him not being able to interpret rules, because he understood cause-and-effect (grabbing toys from other kids = timeout). I think it had to do more with not being able to interpret an object as something more than its obvious physical attributes (color, shape, and what happens if you smash it onto something).

Experiments in Programming version 2.5

So, I refined my game into “How To Train Your Robot To Jump”. Our contract became “Pretend I’m a robot. If you place an arrow facing upwards, I’ll jump up. If you place an arrow facing down I’ll do a push-up”. I thought that using arrows to face up or down should be less abstract. Also, I waited until he was 2.5 years old. He was better at paying attention.

We tried this new game and it worked!

Take the arrows…

Place them up or down…

And wait for me to execute the program…

Which is what programming is fundamentally about: use a language to describe a task that is automated and whose results you see after you are done.

(Keep in mind, that girls are more advanced than boys at that age, so my son serves as a how-early-can-a-kid-program upper bound of sorts.)

He was so excited that he wanted to do what I was doing. So, he’d place the arrows and then jump up or drop down.

Then we started getting creative. How about putting the arrows facing left or right and I jump to the left or to the right?

(And how about a couple of dinosaurs around to help us debug?)

There was not much action happening with only 3 arrows. He wanted to keep me jumping. Kids around that age understand numbers, so we introduced numbers into the mix and I told him that if he put the number 6 in front of an upward facing arrow, then I’d jump up 6 times.

We were 10-15 minutes into the game by then, and the game started looking like a real workout (physically for me and mentally for him).

At that point he was more interested in how numbers and arrows looked together in large quantities rather than the program itself. We called it a day. A good one indeed.

I hope we learned something useful today,
DrTechniko

Filed Under: child, class, computer science, education, programming Tagged With: children, game, programming class, robot

  • Go to page 1
  • Go to page 2
  • Go to Next Page »

Footer

  • Facebook
  • Pinterest
  • Twitter

Copyright © 2025 DrTechniko · All Rights Reserved · Contact DrTechniko

 

Loading Comments...