Archive for the ‘code’ Category

weatherbot

Sunday, April 23rd, 2017

TJBot is an open-source do-it-yourself kit for building a small Raspberry-Pi-powered robot.

Building

In the Easter holidays, we spent an afternoon building it…

…and wiring it…

This gave us a tiny plastic robot with a light in his head, and an arm that can rotate back and forth. He sits on the kitchen shelf next to the Alexa.

This weekend, we tried doing something with it.

(more…)

I-Spy (using Watson services from Scratch projects)

Wednesday, February 22nd, 2017

It’s half-term week, so that means more time for geekiness with the kids.

This is something Grace made this week: a game of “I spy” built using Scratch, that uses the Watson Vision Recognition API to let the game dynamically pick objects that it recognises in photos, so you can then make guesses.

Apart from being a fun game to make in it’s own right, I wanted to share why I particularly think it’s useful to be able to use Watson API’s from Scratch projects.

Screen Shot 2017-02-22 at 13.43.53

(more…)

Machine learning “Top Trumps”

Saturday, October 1st, 2016

A simple demonstration of machine learning to let a child train a computer to play Top Trumps

I’ve been talking for a while now about how we introduce the idea behind machine learning to school kids. I’ve given several talks about it but I’ve also tried out a couple of approaches to it.

Now I’m trying out another: training a machine learning bot how to play Top Trumps.

I’ve put a demo at toptrumps.eu-gb.mybluemix.net.

screenshot

What is this?

It’s basically Top Trumps: that card game I used to play as a kid where you choose one of the attributes on a card, and if it beats the other player you get their card. Except it’s online, and you’re playing against a computer.

But the computer hasn’t been given any strategies on how to play, and has to learn from the player.

Initially, it makes random choices, but it learns from playing against the player. The more turns it plays, the more training it gets, which it uses to make predictions of which choice would give it the best chance of winning. (more…)

Normalised Discounted Cumulative Gain

Friday, July 15th, 2016

A ramble about accuracy compared with NDCG scores for evaluating effectiveness of information retrieval. It’s an introduction, so if you already know what they are, you can skip this.

A couple of weeks ago, we released a new tool for training the IBM Watson Retrieve and Rank service (a search service that uses machine learning to train it how to sort search results into the best order).

This afternoon, I deployed a collection of small updates to the tool and thought I’d make a few notes about what’s changed.

Most of them are a bunch of incremental updates and minor bug fixes.

For example, support for a wider range of Bluemix environments, support for larger document cluster sizes, displaying the amount of disk space left in a cluster, and so on.

One update in particular I thought was more interesting, and worth explaining.

(more…)

Watson Rock, Paper, Scissors

Sunday, June 26th, 2016

A simple hands-on activity to let kids train a machine learning classifier to be able to play Rock, Paper, Scissors.

Screen Shot 2016-06-26 at 13.59.20

I’ve written and spoken before that I think we should do more to introduce children to the idea of machine learning. And I’ve tried introducing my two kids to it, such as by making a Code Club-style game with them: we built a system to play Guess Who, that they trained both to understand what you say and to recognise the characteristics of faces from photos.

This weekend, we tried out another idea – Rock, Paper, Scissors from a web app, using the web cam to see your moves, and training a system to recognise your hand signs.

DSC06146

(more…)

An introduction to machine learning with Guess Who

Thursday, February 18th, 2016

I tried introducing my two kids to machine learning by helping them make a game this week.

In this post, I’ll try and explain why, how we did it, and how it went. And if you make it all the way to an end, I’ve got some videos and a link to a demo to show you what we made.

Why

I think we need to introduce the basic concept of machine learning to children.

I think the current approach to introducing coding using things like Scratch aren’t enough. This isn’t to say Scratch isn’t great (I’ve been running a Code Club every week for the last couple of years, delivered almost entirely using Scratch, so I’d be the last person to say it isn’t a fantastic tool). It lets you snap together blocks representing actions to teach the programming mindset of getting a computer to do something by you breaking the task down into a series of steps.

I think we need to add to this with something that introduces the model of machine learning – getting a computer to do something by training it with examples of doing that task.

I’ve been saying this for a while – I gave a talk about it at an education conference last year, I’ve written about it here before, and it was the theme of a lecture I gave at a science society in London last month.

This week is half-term and I have the week off work, so I thought I’d finally spend a bit of time trying it out by experimenting on my own two daughters (Faith and Grace, who are aged 7 and 11).

In Code Club, I mostly try to introduce programming concepts by helping the kids to create games. Sticking with what seems to work, I’ve helped them to make a game by training an ML system how to play it.

(more…)

Connecting to MQ Light from a web app via WebSockets

Monday, May 25th, 2015

How to subscribe to MQ Light notifications from a web app, via a WebSockets bridge

I’ve been working on a microservices app hosted on Bluemix. It’s one logical app, but it’s implemented and deployed as a bunch of separate Bluemix applications, each with it’s own separate responsibility.

I’m using MQ Light as asynchronous messaging between the apps. Each Bluemix app publishes notifications about changes to resources, and the status of long-running tasks.

mqlight on Bluemix

I won’t labour why or how we do this here, as it’s well covered in many other posts on microservices. For example:

…publish everything, however boring and insignificant it may seem to the rest of the system. Publishing is very lightweight and the publisher does not need to know whether 0 or 1000 other services are interested in that particular event, just fire and forget. This is extremely powerful and is what enables microservices to be built and deployed extremely quickly…

This is working well, but I also want a web app to be able to get some of these notifications.

If the web app has a resource open for editing, I want it to get a push notification if there are any changes to the resource.

If the web app started a long-running task, I want it to get push notifications of status changes.

I’ve done this by writing a small proxy, allowing a web app to subscribe to MQ Light topics and get the message via WebSockets.

Essentially, it’s an mqlight-WebSockets bridge.

mqlight with WebSockets on Bluemix

(more…)

Recycling: a Scratch game for Code Club

Sunday, April 19th, 2015

Grace and Faith have been helping me work on a new project for Code Club. It’s not quite finished yet (Excuse: Thanks to the holidays, it’s still over a week till my next Code Club class!), but it’s close enough that I thought it’s worth sharing the work-in-progress.

The basic idea (more than a little inspired by an old Mega Drive game we’ve played) is that you have to catch falling bits of rubbish and put them in the correct recycling bin.

A playable version is embedded here if you’re using a Flash-friendly browser. Press the green flag to start, use the arrow keys to run left and right, and press the space bar to throw what you’re carrying. (If the embed isn’t working, you can also get to it on the Scratch website.)

I’ve started writing up how we made it, using Code Club’s lesson format tool. (A tool that reads Markdown with a few Code Club-specific extras).

The write-up is still a little rough around the edges, but the source for what we’ve got so far is on github.

And I’ve used lesson_format to create HTML and PDF versions in the Code Club style.