Abstract
What should you eat for breakfast today? What should you wear to school? You make many decisions every day and consider lots of information when making those decisions. What if you could train a computer to make those decisions for you using artificial intelligence? In this project, you will not need to do any computer programming yourself, but you will do some simple math to show how a computer program called a neural network can learn to make decisions.
If you want to try a version of the project that involves computer programming, see Explore Perceptrons: A Simple Type of Neural Network.
Summary
None (no programming is required for this project)
Readily available
No issues
Objective
Design your own simple neural network to make a yes/no decision based on several inputs.
Introduction
Imagine that you are trying to decide whether or not to go to the playground. You can make this decision because your brain is full of billions of neurons, or cells that can send signals to each other. Your neurons gather information (inputs) from your senses and help your brain process this information to decide on outputs or actions. What if you wanted a computer to make the same decision? Having a computer "think" like a human is a field of science called artificial intelligence (AI). Sometimes it is hard to program a computer to tell it exactly what to do. Instead, we can "teach" a computer to accomplish something without telling it exactly what to do first. The computer can learn through trial and error, just like a human baby learning to walk or talk. This process is called machine learning (ML).
When deciding whether to go to the playground, your brain may use inputs like, is it sunny out? Are your friends going? Are you done with your homework? Your decision would depend on the answers to these questions. In this project you will explore the basics of how AI can make very simple decisions, without needing to do any computer programming yourself.
You can represent a decision-making process with an algorithm, or a set of instructions for a computer to follow. An algorithm can have inputs (information like whether or not it is sunny) and outputs (like the yes/no decision to go to the playground). You do not need to write any computer code to design an algorithm. You can just write down the instructions in everyday language. For example, you could say "if at least two of the inputs are yes, then I will go to the playground." You could also represent your algorithm with a diagram like Figure 1. If it is sunny out, your friends are going, but you are not done with your homework, this algorithm would tell you go to the playground because at least two of the inputs are yes.

Aria text: a circle labeled 'check if at least 2 inputs are yes.' Three input arrows point toward the circle, each with yes/no options. Input 1: is it sunny out? Input 2: are my friends going? Input 3: Am I done with my homework? An output arrow, should I go to the playground? (yes/no) points away from the circle.
Figure 1. Diagram representing an algorithm to decide whether or not to go to the playground.
That simple approach works if all of the inputs are equally important to you. However, what if you really want to see your friends, and do not care about the weather as much because you can just put on a jacket? You might assign a different level of importance, or weight, to each one of the inputs. You might weigh the different inputs in your head when deciding whether or not to go. A computer program can do the same thing using math. To do this, you need to represent each input for the computer with a 1 for "yes" and a 0 for "no." Then, you can follow the process shown in Figure 2:
- Multiply each input (1 for "yes" and 0 for "no") by its weight
- Add up all the resulting values
- Compare those values to a threshold value to determine whether the output is 1 or 0

Aria text: a circle labeled 'add up the values and check if the result is greater than or equal to the threshold.' The circle has three input arrows, each of which can be one or zero: is it sunny out? Are my friends going? Am I done with my homework? Each input value is multiplied by a respective weight. The output, which can be 1 or 0, is 'Should I go to the playground?'
Figure 2. Diagram representing an algorithm with weights.
You can also write the process from Figure 2 using equations:
If
If
Do not worry if that seems confusing—we will walk through a complete example using numbers. First, we have to "pick" the weights and the threshold to use. For a very simple example like this, will just hand-pick a few random weights and a threshold to start: weights of 3, 5, and 1 for the sunny, friends, and homework inputs respectively, and a threshold value of 6. Using the same scenario from earlier (it is sunny, your friends are going, and you are not done with your homework), you can calculate the sum using the equation above:
Then, comparing this sum to the threshold:
You see that the answer is 1, or "yes" you should go to the playground. It might help you do the math if you write the problem out in table format, like Table 1.
| Input | Value | × Weight | = Subtotal |
|---|---|---|---|
| Sunny? | 1 | 3 | 3 |
| Friends? | 1 | 5 | 5 |
| Homework? | 0 | 1 | 0 |
| Sum | 8 |
Table 1. Inputs, weights, subtotals, and total value for the example problem.
Now that you have an equation and/or table set up, you can quickly see what happens if you change one of the inputs. For example, say that it is no longer sunny out, so the input for sunny changes to a 0. You can go through the same calculation to see that:
The new output is 0, or "no," and you should not go to the playground.
Since this is a very simple example and we can do the math by hand, you could look at the new output and think "hey, that's not right! I really want to see my friends, I don't care if it's not sunny!" You could then change the weights to change the output (for this simple example, we will keep the threshold constant). For example, you could increase the weight for "friends" to 7. This would give:
And now the output says that you should go to the playground even though it is not sunny. You could continue teaching, or training your algorithm, by testing different combinations of inputs, evaluating the output, and adjusting the weights. Your algorithm might be "wrong" most of the time at first, but eventually, as you fine-tune the weights, you can get it to be "right" most or all of the time.
The process shown in Figure 2 is a model of the behavior of a single artificial neuron. This is all you need for a simple decision like our playground example. More complex artificial intelligence programs, like those used to recognize objects in pictures, have many neurons. These programs are called artificial neural networks, and they are designed to mimic the behavior of biological neural networks in the brain. A neural network that has a single "yes or no" output is called a perceptron. These networks can be very complex, and typically have far more weights and thresholds than a person could ever adjust by hand. Instead, the programs adjust the weights and thresholds automatically depending on whether their outputs are right or wrong. This process involves more advanced math, so in this project, we are keeping it simple and you are adjusting the weights "by hand."
Now it is your turn to try it out. In this project, you will go through this process for your own decision with your own set of inputs. Can you design simple neural network to make your decisions for you?
Terms and Concepts
- Neuron
- Artificial intelligence (AI)
- Machine learning (ML)
- Algorithm
- Input
- Output
- Weight
- Threshold
- Training
- Model
- Neural network
- Perceptron
Questions
- What are some simple yes/no decisions you make every day?
- What are the inputs you consider when making those decisions?
- Are some of the inputs more important than others?
Bibliography
- CrashCourse (Aug. 9, 2019). What Is Artificial Intelligence? Crash Course AI #1. Retrieved May 24, 2023
Materials and Equipment
- Dice
- Lab notebook
- Pencil
Experimental Procedure

- Think of a decision you could make that has a yes/no answer. For example, you can use "should I eat cereal for breakfast today?" but not "what should I eat for breakfast today?" Write this question down. The answer to this question will be the output of your machine learning algorithm.
- Think of three inputs, or questions that you would ask, to help you make your decision. Each input should also be "yes/no." For example, you could use "Is it hot outside?" but not "What is the temperature in degrees Celsius?"
- Create a table like table 2, with a row for every possible combination of inputs. For three inputs with two options each, there should be eight possible combinations.
| Input 1 | Input 2 | Input 3 | Output (your decision) | Algorithm output (trial 1) | Algorithm output (trial 2) | Algorithm output (trial 3) |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | ||||
| 0 | 0 | 1 | ||||
| 0 | 1 | 0 | ||||
| 0 | 1 | 1 | ||||
| 1 | 0 | 0 | ||||
| 1 | 0 | 1 | ||||
| 1 | 1 | 0 | ||||
| 1 | 1 | 1 |
Table 2. All possible input combinations and the corresponding output (as decided by a human).
- For each row in table 2, fill in what you would decide for the output based on the three inputs, using 1 for "yes" and 0 for "no." You will compare these "correct" answers to the output of your algorithm.
- Pick random weights between one and six for each of your three inputs. You can do this, for example, by rolling a die, or writing numbers 1–6 on pieces of paper and drawing them out of a cup. These initial weights might not be correct, but that is OK! You will adjust them later as your neural network "learns." To keep the project simple, you will only adjust the weights and not the threshold. Use a fixed threshold value of 9 instead of choosing a random threshold.
- Make a table like table 3 to help with your calculations.
- Fill in the values for the inputs (using 1's and 0's) from the first row of Table 2.
- Multiply each input value by its weight to calculate the subtotal.
- Add up the subtotals to calculate the total.
| Input | Value | × weight | = subtotal |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| Total | |||
Table 3. Table for calculating the total value for a given combination of inputs.
- Compare the total to the threshold value of 9. If the total is greater than or equal to the threshold, write a "1" in the column for "trial 1" in the first row of Table 2.
- Repeat steps 6–7 for each row of Table 2. Do not adjust your weights yet. Use the same weight values for all of Trial 1.
- Now, compare the "your decision" column to the "trial 1" column. By comparing the two sets of outputs, can you tell if one of the inputs is weighed too much or too little in your model?
- Adjust one of the weights (do not change multiple weights at once) and then repeat steps 6–9. Are the results of your model closer to the "right" answers this time?
- Adjusting one weight at a time, continue to repeat this process. You can add more columns to Table 2 for additional trials if needed. Remember that in a larger neural network, the computer would automatically adjust the weights and thresholds during the training process. In this simple example, you are making the adjustments by hand.
- Analyze your results.
- Can you reach a point where your model is correct (its output matches the "your decision" column) 100% of the time?
- Do you get "stuck," or reach a point where you cannot get the model to be correct 100% of the time no matter how you adjust the weights?
- Would you trust your model to make this decision for you if you just gave it the inputs?
Ask an Expert
Variations
- Instead of doing the math by hand, can you make a spreadsheet or write a program to do the math for you?
- Can you design a neural network with more than three inputs, or more than one output?
- Can you write a computer program to do the calculations for you? Try using Scratch if you do not have any programming experience.
Careers
If you like this project, you might enjoy exploring these related careers:









