Rhodri Davies, Programme Leader, Giving Thought

Rhodri Davies

Head of Policy

Charities Aid Foundation

The role of giving

Share this blog

Do Androids Dream of Electric Donkey Sanctuaries?

What you learn by training an AI system to name charities

1 March 2019

This is a longer version of the article about our experiment with AI which first appeared in Charity Digital News, containing a bit more technical detail.

Creating the CharityNamer AI system

Q: What do the following charities all have in common?

  • Advocacy 4 Women
  • Man First Foundation
  • New Life Church, Stratford-Upon-The-Sea
  • The Bus Consolidated Charities
  • East Midlands Museums Charity
  • The International Society for Training
  • The Coast To Be Foundation
  • Suffolk and South Gloucestershire Medical Trust

A: None of them actually exist. The names were all generated by an artificial intelligence system. One that I cobbled together in a quiet morning.

Your immediate questions are probably: “what exactly did you do?” and perhaps even more importantly, “why?”

Well firstly (and very briefly) let’s deal with the “what”. I used a bunch of freely-available tools to create an algorithm (ie a decision process) capable of spitting out made-up charities on demand.

I did this by taking an existing version of what is known as a “machine learning” algorithm - this is a type of algorithm where instead of all the rules being set up front, you can instead “train” it to do things by giving it a large data set to ‘learn’ from and allowing it to go through a process of trial, error and self-modification. In this case, the algorithm in question was what is known as a neural network.

By doing this, over time the algorithm can get very good at identifying patterns and being able to make predictions. I then fed it the names of all registered charities in England and Wales as of November 2018, let it run for a bit to learn and: presto. I had a rough-and-ready neural network capable of generating charity names (you can peruse the list I generated here if you are interested)

(If you want slightly more technical detail on how this all worked and how you could do it yourself, read the paragraph at the end of this blog)

So, now for the more important question: why did I do this?

1 For a bit of fun

There are lots of examples now of people training text-based neural networks to generate all sorts of things, from band names to new paint colours. In amongst all of the perfectly sensible outputs these systems come up with, there is usually a good number that fall squarely in the “uncanny valley”, where they are close enough to normal to feel familiar, but just weird enough to jar. And that is often hilarious.

I thought that the same thing might be true for charities, and I wasn’t disappointed. Some of the suggestions my CharityNamer system came up with were wonderfully generic eg:

  • Much Society
  • Aid for the Kids
  • The Library and Museum Trust
  • The Advance Project God Christian Centre
  • Men for the Parent Teacher Association
  • Civic Without Borders

Some were decidedly silly eg:

  • Four Winds Relief
  • Cross Child Contact Centre
  • We a Little Blind
  • Friends of School Special School
  • People for a Team
  • The Joseph Syndrome Trust
  • Theological Association of Tyneside and Drug Archives

And others were just varying degrees of weird eg:

  • The Friends of Table
  • Youth and Friends of Surgery Castle.
  • James for Prizes in the Parish of Cambridge
  • Clubs International of Funeral Teachers Imagine and Nursery School
  • Radio Fire Charity

A particular favourite genre of mine were those names that looked ostensibly sensible but became ridiculous the more you thought about them - usually for geographic reasons. For example Slough Central and West Gwynedd Life centre for the Blind (difficult combined area of operation there) or Lewisham Young Farmers (which should definitely be the name of a hipster band, if it isn’t already).

2 To demystify “artificial intelligence” a bit

The first slightly more serious point I wanted to make by doing this experiment is that “artificial intelligence” is not as mysterious and inscrutable as it often sounds. The terminology itself is probably not that helpful - as it immediately calls to mind depictions of killer robots or computers with superhuman intellectual capabilities of the sort we all know from books and films - but this is pretty misleading. Whilst there are AI systems out there that are able to do amazing things already, none of this stuff is magic.

Terminology like “neural network” and “machine learning” admittedly sounds cool, but what you learn very quickly by playing around with a pretty basic version of an AI system is that it is much less glamorous than it sounds. What you are actually dealing with most of the time is data files, computer code (in this case in Python) and really ugly user interfaces.

Obviously, I should stress that it is far beyond my capabilities to build a neural network: I merely piggybacked off the hard work of someone else who had created an open source one that I was able to harness. And I certainly don’t want to underplay the hard work of the person who actually created it! My point is just that the way I was able to tap into this neural network highlighted the fact that even if it is a pretty clever bit of coding; all it is actually doing is an automated process of statistical regression and self-modification. Once you understand that, the whole thing seems a lot less glamorous and mysterious - and all the better for it in my opinion!

3 To show that using AI needn’t require lots of technical skills or money

As well as demystifying what AI actually is (at least in its most basic form), my other hope was that by doing this experiment myself I could demonstrate that the barriers to getting involved aren’t as high as many would assume.

OK - let’s not pretend that what I did was exactly sophisticated, and the output was very far from the finished article. However, it can genuinely be called artificial intelligence (at least insofar as anything can) and I was able to make it work without spending any money, without any specialist technical knowledge and with no equipment other than my own laptop.

All the resources I used were free- the data on charities is available from the Charity Commission, the code for the textgenrnn neural network is available open source via GitHub and you can run it for free using Google’s Colaboratory environment (which allows you to tap into their powerful TensorFlow machine learning software). Likewise, all I brought to the table in terms of relevant abilities was a half-forgotten maths degree, a decent amount of intellectual curiosity, and a bit of sheer stubbornness. The hardest part for me was getting the list of UK charities in the right file format, which is where I buckled and asked some help from one of my colleagues, but I’m pretty sure I would have managed it in the end by myself if I hadn’t had anyone to call on.

So if you are vaguely computer literate and fancy having a go, why not get stuck in? Chances are that you’ll be able to come up with something far more impressive and useful than I have!

4 To shed light on the charity sector

My final point is less to do with AI, and more to do with what the outputs of the system show about the charity sector. In order to understand what I mean, consider what the neural network is actually doing as it learns. In this case, it is running repeatedly through the list of names of all charities in England and Wales and identifying relationships between different words, to which it then assigns probabilistic weightings. As the system goes through the data more times, it improves itself by refining these weightings. When the system has ‘finished learning” (ie after the set number of cycles or ‘epochs’ have elapsed), you are left with a model that is able to generate strings of words based on the probability of which will sound like real charities based on the training data.

As this is basically a statistical procedure, the results reflect patterns in the data. This is the same reason that you hear about ‘algorithmic bias’: when machine learning algorithms are trained using data sets that contain historical or statistical biases, they come to reflect those same biases and in fact strengthen them over time. When the bias in question is for a factor like race or gender and the algorithm is being used to determine eligibility for bail or suitability for a job; that is potentially a huge problem. In this instance, however, we can use the biases that the CharityNamer AI developed in a positive way, to highlight various things about the composition of the charity sector.

The system is trying to generate credible-sounding charity names, so if it comes up with one sort of name a lot that suggests that organisations with that kind of name are particularly common. And from my not-very-scientific look through the names the system produced I could deduce two things straight away:

  1. The vast majority of the charity sector is made up of very small, local charities

  2. Religious organisations are a big part of the sector (as are educational organisations and overseas organisations, to a lesser extent).

Now, neither of those findings will be especially surprising to anyone who knows about the UK charity sector. However, I found that looking through the efforts of my AI system to come up with charity names did highlight them in a fresh and compelling way, and as such was very effective at making the point.

I’m sure that a more detailed and systematic analysis of the list of names would highlight other trends that could be used in a similar way to bring different aspects of the charity sector to life.

What does all this mean?

Hopefully, it should be clear from what I have said that although this experiment is largely just a bit of fun, it does make some serious points about the way in which the charity sector could engage with artificial intelligence and machine learning. IT also highlights some options that people who are looking at how to start a charity can think of a potential name. I hope that some of you feel inspired to get stuck in and experiment for yourselves to see what is possible!

Technical Details (if you want them!)

For those who want a bit more detail, I used publicly available data provided by the Charity Commission (with some help from one of my colleagues who is a data specialist and helped me navigate the unfamiliar world of .bcp files and relational databases).

Using this data in a .txt file as a basis, I trained a text-generating machine learning system based on the freely-available textgenrnn neural network and using Google’s Colaboratory cloud-based, open source data science platform to run it (which gives you free access to their powerful TensorFlow machine learning tools). I ran this initially for 40 epochs, which gave me my “Charity Namer” neural network. This was temporarily stored in Colaboratory, but I was also able to download the model to use it offline (which also requires downloading some additional software to run it).

If you fancy trying it yourself, a good place to start is this really handy guide on “How to Quickly Train a Text-Generating neural network for Free” by Max Woolf, who created the TextGenRNN neural network.

More on Artificial Intelligence and Charity, from CAF

Charities use of Artificial Intelligence

Our research outlines how charities already use AI successfully and the potential challenges and opportunities it will bring in the future.

Read our findings

Artificial intelligence and the future of charity

We are campaigning for new technologies to have a positive impact on the future of charity and philanthropy.

Read about the future

Machine-made goods: charities, philanthropy and artificial intelligence

What implications will Artificial Intelligence have for civil society and the work of charities?

Read the report online