Skip to content

About

This repository contains an activity where students will learn how to interpret EEG signals and practice labeling data by hand. Then, they will build and test a simple machine learning model in MATLAB using the k-nearest neighbor algorithm to classify EEG data automatically and compare its accuracy to their own predictions.

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Decode Brain Waves with Machine Learning

Open in MATLAB Online

This repository contains an activity where students will first learn how to interpret EEG signals and practice labeling data by hand to determine when a subject’s eyes are open or closed. Then, they will build and test a simple machine learning model in MATLAB using the k-nearest neighbor algorithm to classify EEG data automatically and compare its accuracy to their own predictions.

Learning Objectives

In this activity, students will:

  • Understand the basics of EEG signals and how they can indicate whether eyes are open or closed.
  • Learn what features are in data and how feature extraction (like signal strength) helps classify EEG patterns.
  • Explore how machine learning works by training a computer to recognize patterns in EEG data using the k-nearest neighbor algorithm.
  • Practice building and testing a simple machine learning model to classify EEG data automatically.
  • Evaluate and compare the accuracy and efficiency of human labeling vs. computer predictions.

Set-up

Required MathWorks® Products (https://www.mathworks.com)

Other Materials

  • Printed activity handout ("EEG_Classification_Activity_Handout.pdf")
  • Colored markers or pens

Instructions

  1. Download or clone the contents of this repository OR click "Open in MATLAB Online".
  2. Open the "EEG_Activity_Instructor_Guide.pdf" and follow the step-by-step instructions. A quick overview:
  • Review the background information in the science primer section of the instructor guide with students.
  • Instruct students to complete the activity handout ("EEG_Classification_Activity_Handout.pdf") and practice classifying EEG signals by hand.
  • Instruct students to open the Live Script titled: "EEG_Classification_Activity.mlx" in MATLAB and follow the guided activity instructions.
  • Guide students through Parts 1-4: students will practice building, testing, and evaluating a simple machine learning model to classify EEG data in MATLAB and compare the results to the predictions they made on the handout.
  • If time permits, guide students through Part 5: students will go head to head with the computer in classifying single seconds of EEG data.
  1. Guide students through a discussion to reflect on the use of machine learning algorithms for data classifcation (and beyond!) and the applications of EEG data.

License

The license is available in the License.txt file in this GitHub repository.

Community Support

MATLAB Central

Copyright 2025 The MathWorks, Inc.

About

This repository contains an activity where students will learn how to interpret EEG signals and practice labeling data by hand. Then, they will build and test a simple machine learning model in MATLAB using the k-nearest neighbor algorithm to classify EEG data automatically and compare its accuracy to their own predictions.

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors