Posts Tagged ‘python’

Machine Learning for Kids with EduBlocks

Saturday, July 8th, 2023

Students can now create Machine Learning for Kids projects using EduBlocks – letting them create machine learning Python projects in the browser by dragging and dropping blocks on a canvas.

This is all thanks to a fantastic new contribution from Joshua Lowe.

Here’s a quick run-through to show what this makes possible.

(more…)

Using repl.it with Machine Learning for Kids

Sunday, May 10th, 2020

Students can work on machine learning projects in Python entirely in the browser, without any need for setup, installs, or registration.

(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…)

Parsing roman numerals with Python

Sunday, November 2nd, 2014

Or… how I managed to make some of Grace’s maths homework into another Code Club session

IMG_0355 Grace had some maths homework to do this weekend, converting a bunch of roman numerals into normal numbers.

Being an interfering sort of parent, I got her to show me what she’d done when she finished.

I could see that she’d gotten a lot of them wrong. She had missed the subtraction you’re supposed to do when a large value follows a smaller value.

I’m a big fan of rubber duck problem solving, but she hadn’t spotted that she’d gone wrong. I decided to try something similar.

(more…)

Comparing XML files ignoring order of attributes and child elements

Monday, October 6th, 2014

I need to diff some XML files.

For these particular XML files, order is not important. The XML is being used to contain a set of things, not a list – the order of the elements has no significance. Similarly, the order of the attributes within each element isn’t significant.

For example, for my purposes, these two XML files are equivalent:

<myroot>
    <mychild id="123">
        <fruit>apple</fruit>
        <test hello="world" brackets="angled" question="answers"/>
        <comment>This is a comment</comment>
    </mychild>
    <mychild id="456">
        <fruit>banana</fruit>
    </mychild>
    <mychild id="789">
        <fruit>orange</fruit>
        <test brackets="round" hello="greeting">
            <number>111</number>
        </test>
        <dates>
              <modified>123</modified>
              <created>253</created>
              <accessed>44</accessed>
        </dates>
    </mychild>
</myroot>
<myroot>
    <mychild id="789">
        <fruit>orange</fruit>
        <test hello="greeting" brackets="round">
            <number>111</number>
        </test>
        <dates>
              <accessed>44</accessed>    
              <modified>123</modified>
              <created>253</created>
        </dates>
    </mychild>
    <mychild id="123">
        <test question="answers" hello="world" brackets="angled"/>
        <comment>This is a comment</comment>
        <fruit>apple</fruit>
    </mychild>
    <mychild id="456">
        <fruit>banana</fruit>
    </mychild>
</myroot>

I needed to compare some large XML files, which have big differences in the order of elements, and I couldn’t find a tool that would do the job. So I wrote a bit of Python to do it for me.

(more…)

Creating an iCalendar from online timetables

Sunday, January 19th, 2014

I’m a member of my local swimming pool, Fleming Park. I’m trying to swim a lot at the moment (as it’s a big help for my back).

I don’t have a regular schedule, I just try and squeeze in time for a swim any time I can spare. This means I’ve not learned the pool’s schedule and frequently have to check their website to find when the pool is available.

I’m checking it so frequently that it’s one of my Most Visited thumbnails in Chrome.

This isn’t efficient, particularly as it’s normally on my phone making me switch between the browser and Calendar apps. It’d be quicker and easier if I had the timetable in my calendar alongside my appointments, so I could easily see when I’m free and the pool is open.

The leisure centre doesn’t provide a feed so I can subscribe and add their schedule to my calendar.

So I made my own.

dalelane.co.uk/…/swimflemingpark.ics

If you use the Fleming Park pool, import this in your Calendar app (or subscribe to it from Google Calendar) and the next week’s pool timetable will be kept up to date in your calendar.

(more…)

Smile!

Tuesday, April 3rd, 2012

The visualisations on this page need Flash and Javascript. Apologies if that means most of this page doesn’t work for you!

This is my mood (as identified from my facial expressions) over time while watching Never Mind the Buzzcocks.

The green areas are times where I looked happy.

This shows my mood while playing XBox Live. Badly.

The red areas are times where I looked cross.

I smile more while watching comedies than when getting shot in the head. Shocker, eh?

(more…)

My first experience using BlueVia APIs

Sunday, October 2nd, 2011

I wrote yesterday about a quick hack I did at Over The Air using the BlueVia API. I thought it was worth a quick post to show just how simple it was.

Read yesterday’s post for background to the idea behind the hack, but in essence, what I wanted was:

  • monitor the location of my mobile phone
  • send an SMS to a different mobile number when my phone goes into a predefined known area

BlueVia provides an API that let me doing this using network operator data. In other words, nothing needs to run on my phone itself as location data is obtained from where O2 thinks my phone is.

This means there is no battery-life impact on the phone for this monitoring.

It also means this will work with any phone – from iPhones and Androids to cheap feature phones.

The whole thing took me less than an hour and needed only 90 lines of Python.

This is how I did it.

(more…)