Skip to main content
Skip to main content

Anti-bullying AI

Integrating Digital

Years 5-6; 7-8

DT+ Health and Physical Education

Sometimes we write and post things on social media in a hurry. Such posts can hurt people and even make them feel bullied. Wouldn't it be great if an Artificial Intelligence application could check our posts as we write them, and warn us if they were potentially hurtful?

This lesson was developed by the Digital Technologies Institute in collaboration with DT Hub.

Decorative image

Image credit: geralt/ pixabay

Preliminary notes

MyComputerbrain is the tool used in the plugged activity below. You can use this link to access this program.

The above image shows the view, consisting of an Artificial Neural Network (ANN) and a table with expressions that most people would consider either ‘kind’ (left-hand column) or ‘mean’ (right-hand column).

The grey boxes in the input, hidden and output layer are called ‘perceptrons’. A perceptron is a model or program that simulates mental decision making. Perceptrons can be likened to neurons in the brain. On the far left-hand side of the ANN, we see all words from the ‘kind’ and ‘mean’ expressions in the table. They are provided to the ANN as learning (or training) data. The ANN calculates whether those words are more likely to fit the ‘Kind things’ or the ‘Mean things’ category based upon the data the user supplied it (in the table).

Suggested steps

Unplugged activity

  1. Use a suitable hook to discuss bullying.
    • What is bullying? Have you been bullied?
    • Why is it important to recognise bullying?
    • What effect does bullying have on someone?
    • Are cases of bullying always intentional, or can you think of instances where they may not be?
    • In daily conversation, what words or phrases might be considered ‘mean’ and potentially a form of bullying? You may wish to create a table on the whiteboard separating out nice and mean words/phrases—you can keep this list up for the plugged activity later.
  2. Students increasingly use social media messaging to communicate with their friends.
    • What are the social media communication tools that students use?
    • In an effort to message back quickly, what do you think might occur? Have you made spelling or grammatical mistakes, or has your message been misunderstood?
    • How might sarcasm or irony be interpreted as, or lead to, bullying?

Plugged activity

  1. Explain that computers can be programmed to be intelligent or at least smart. Ask the class if they think a computer could work out whether something they write is kind or mean? How would it do this?
  2. Use the application My Computer brain, which lets you train an AI application to recognise posts and match them to a particular output. No coding is required. We have provided an example of what it might look like in the image above. Students can enter a total of 12 expressions, including single words and whole sentences.
  3. The instructions in the right-hand menu of the application will guide students through the process, which consists of:
    • creating training data
    • training the ANN via the ‘Start Learning’ button (you need to let the application cycle through all the training cycles—it will say ‘Learning Completed’ when finished)
    • testing the ANN by entering short sentences in the input field (where it says “enter post” at the top of the window. Please note, when you test out to see if the AI is smart, it uses black for the predicted category (e.g. “Mean things”) and not a more obvious colour such as green.

  4. As a special feature, the ANN will be constructed in real time, while students enter the training data. This is intended to help students understand how the input data influences the topology of the ANN. It is also an opportunity for the teacher to discuss data input, and more general human sensory perception.

    Note: The student input is not stored. When the browser window is reloaded, the experiment is reset. This is to ensure that especially mean expressions are not used for purposes other than the experiment.

  5. Share what you have learned about AI and how ‘intelligent’ a computer can be.
  6. Students may come up with their own training data and project to test the AI further. Here are some prompts:
    • How will the AI decide when kind and mean words are used in combination?
    • Can the AI pick up sarcasm or irony?
    • How could the AI be improved (eg by adding a thesaurus that could recognise similar words)?


  1. In the example below, the AI is 0.93 sure that ‘I like you’ is a ‘kind thing’. Discuss the scale used in the ‘Kind things’ and ‘Mean things’ boxes to display the confidence level. A fully black box means the AI was very sure. A light grey box means it was not quite sure. When was the AI very sure of its guess? When was it not so sure?

    Image: confidence level

  2. Look at the table on the right-hand side with ‘Input’, ‘Weight’, ‘Product’, ‘Sum’ and ‘Output’. Each perceptron receives Input data from other perceptrons. Each Input is multiplied by a Weight, leading to a Product. The Products are added up to create a Sum, and then pushed through a function that determines the Output of the perceptron. Note that the mathematics is quite effective, despite its relative ease. Hover your mouse over each perceptron to check its data. Observe that the colour of the lines that connect to the Input of a perceptron correspond to the colours in the Weight column of the table.
  3. Observe how the colours of the lines change as the AI learns. Green means positive values, red means negative values, and black means neutral values. These lines mimic the synapses in our brain and regulate the dataflow between the perceptrons.
  4. Is green more valuable to the AI’s learning mechanism than red or black? No. They are all equally required to achieve the learning outcome.
  5. Note that the words from the training data are provided to the ANN as binary numbers. The ANN’s internal representation of the data is 1’s and 0's.

    Note: The function depicted above is a Sigmoid function: f(x)= 1 / (1 + e^(-x)). The ANN also uses the following derivative of the Sigmoid function during the learning process: df(x)/dx = f(x) * (1 - f(x)).

Why is this relevant

AI refers to the ability of machines to mimic human capabilities in a way that we would consider intelligent.

Machine learning is an application of AI. With ML, we give the machine lots of examples of data, demonstrating what we would like it to do so that it can figure out how to achieve the goal on its own. The machine learns and adapts its strategy to achieve this goal.

In our example, we are feeding the machine with data in the form of words. The more varied the data we provide, the more likely the AI system is to correctly classify the input as an appropriate output. In ML, the system will give a confidence value of how sure it is of the classification it has provided; in this case:

  • a decimal value between 0 and 1
  • white, black and shades of grey to the output box.

This lesson focuses on the concept of ‘classification’, which, in the context of AI, is a learning technique used to group data based on attributes or features.