Day 4: AI in the Physical World

Recap

  • Used scikit-learn, Python’s machine learning library
  • Linear Regression - identify patterns through data
  • Built an AI model using data about the Dzud

AI in the Physical World

  • Today, we’ll bring what we’ve learned into the physical world
  • Learn how AI models work in fitness trackers and other devices
  • Do all of this using a micro:bit

What is a micro:bit?

What is a micro:bit?

What is a micro:bit?

What is an Accelerometer?

  • A small chip that measures acceleration
    • How fast moves from one speed to another
  • Measures acceleration in 3 directions: X, Y, and Z
    • Measures both positive and negative direction

What is an Accelerometer?

But… If the micro:bit is plugged in, how do we move it around?

Introducing the micro:bit Wearable!

Introducing the micro:bit Wearable!

Our Plan

Our Plan

Our Plan

Our Plan

Our Plan

Hands-on

  • Find someone to work with! (Pairs)
  • Pickup two micro:bits (one with and one without wearable)
    • It doesn’t matter who gets which one to start
  • Wait for instructions! (We are going to do this together)

Walkthrough

Visit https://createai.microbit.org

Walkthrough

Record an Action. (Make sure your band is tight!)

Hands-On

Go ahead and record 4 or 5 actions. Take turns in wearing the wearable.

Hands-On

When you have all the actions, click on the “Train model” button.

Hands-On

Take turns and test your actions. How well did the model learn? What happened if you just let your hand do nothing?

Discussion

What worked well? What didn’t work well? Or what did it get wrong?

Hands-On

Click “Edit Data Samples” button to add more data. Add an action for being still (if you don’t already have one).

Diverse Data

What is Diverse Data?

  • AI models learn patterns from the data they are trained on
  • If training data only reflects a narrow group, the model only works well for that group
  • Diverse data includes variation in people, environments, styles, and conditions
  • The more diverse the data, the more fairly and reliably the model performs

Without Diverse Data: Facial Recognition

  • In 2018, researcher Joy Buolamwini studied commercial facial recognition tools
  • She found they worked well for lighter-skinned men…
  • …but had error rates up to 35% higher for darker-skinned women
  • Why? The models were trained mostly on lighter-skinned male faces
  • They simply hadn’t seen enough diverse examples to learn properly

Without Diverse Data: Voice Assistants

  • Early voice assistants (Siri, Alexa) struggled with non-standard accents and dialects
  • They were trained mostly on a narrow range of voices
  • People with regional accents, non-native speakers, or less common dialects were often misunderstood
  • This is slowly improving — but only because companies added more diverse training data

Testing Diversity of our Data

  • Take off the micro:bits and leave both of them on the table
  • Make sure you are in the “Testing Model” screen
  • Swap desks with another pair close to you
  • Take turns to put on their micro:bit and test their actions

Discussion

What did you find? Did they work as you expected?

Reflection

What did you learn today? Was using AI easier or harder than you thought?

Disconnecting the micro:bit

  • Disconnect your receiver micro:bit and leave on the desk
  • Leave your wearable micro:bit connected to the battery pack
    • I will disconnect this for you. (These can be easy to break)

Tomorrow

  • Write Python code that uses our AI models in a mini-app
  • For example, step counter or a fitness tracker
  • Mini-project, show and share