Patricia Campbell
Computer Science

Exploring Machine Learning on an Internet of Things Edge Cluster

By Patricia Campbell
Cohort 2021-2022

Overview

My proposal for the Community of practice was to explore Machine Learning (ML) on an IoT (Internet of Things) edge cluster. Meaning, in a nutshell, instead of using the power of cloud computing to train ML models we use tiny devices that consume fewer resources to do the training.   The real breakthroughs in the use of and research into AI/ML were made possible by the collective resources and power of cloud computing. Before cloud computing became generally available we did not have the capacity to move forward, which is why AI/ML is a fairly recent phenomenon.  Due to the limitations of using the cloud, training on the edge is being explored as a way to supercharge ML.

My experiments took me in a slightly different direction to that which I expected.  It may be possible to explore my original premise in future, but the time and equipment limitations made me realize that in order to have results that were suitable to a Computer Science Tech student I had to pivot.

As I experimented with some Raspberry Pis I created some basic supporting slide decks and some code repositories, the below is a blurb on each.  Note the slides were written with a target audience of Computer Science students.

General Information

I started this as part of my project and I am still working on it, hopefully it provides some clearer definitions of terminology in central place: AI & ML in plain English.

Background

The first slide deck I created was to present students with an understanding of computing on “the edge”: it gives an overview of what edge computing means, what can be done there and why we need ML for decision making.

01 lecture edge computing – template

The second slide deck presents some foundational ideas behind Machine Learning.  It is an overview of the high-level concepts including contrasting training on the edge versus using a pre-trained model.

02 lecture what is Machine Learning  – template

Algorithms & ML & Training

Computer Science students write algorithms beginning in their first courses throughout the whole program.  The next slide deck presents the ideas they have been working with as they create their own algorithms in order to illustrate the need for ML as complexity increases and data factors increase.

03 lecture what is Machine Learning  algorithm – template

The final slide deck introduces the ideas behind training ML algorithms with a simple introductory example using some common algorithms such as a very simplified Linear Regression, K nearest neighbours, and a neural network. Below you can find links to repositories where the code is available.

04 lecture training an ML  algorithm – template

Try the Tensorflow Neural Network Playground

tensorflow

Code

As part of my exploration of this topic I worked with some code to illustrate a few of the simpler ML algorithms and their training in order to gently introduce students with a programming background to the concepts of ML .  The whole repository, referred to in slide deck 04 can be found here: https://github.com/campbe13/experiment-ml-docker-py/

kNN

Scikit Learn: kNN

Using 1 csv to train, 2 gen own dataset 3 plain old python:

https://github.com/campbe13/experiment-ml-docker-py/tree/master/00temperature-example

Linear Regression

SciKit Learn: Linear regression

Using 1. Generate dataset & results  to train 2. Plain old python (3 both of the prev with timing):

https://github.com/campbe13/experiment-ml-docker-py/tree/master/05algebraeic-example

Neural Net

DIY NN (using NumPy & Matplotlib for error chart):

https://github.com/campbe13/experiment-ml-docker-py/tree/master/10neural-net

Using Raspberry Pis & Edge Impulse

As mentioned, I initially wanted to do model training at the edge.  I started by setting up a cluster to attempt federated learning but I was unsuccessful.  Unfortunately the time and equipment limitations made me realize that in order to have results that were suitable to a Computer Science Tech student I had to pivot.  That is when I turned to Edge impulse.

edgeimpulse

Here is a basis for a lab and a log of the possess used: engr log edge-impulse

Supporting the lab: instrs – lab – setup Raspberry PI  also edge training data github

Summary

Any of my work posted here may be used as base material, all are licensed (except where stated otherwise).  My own written work is licensed under CC BY-NC-SA 4.0. My own code is licensed under The MIT License (MIT).

As always there is more to learn and more to adjust for the CEGEP student depending on the level of the students and the course but please consider it all a work in progress!  Any errors or omissions are my own.