A bank's old fraud check was a rule somebody typed in by hand: flag a card payment if it is for more than 500 and the card has never been used at that shop before. Its replacement is a single artificial neuron, and nobody chose its numbers. Its three weights and its bias were learned from thousands of past payments that had already been labelled fraud or genuine.
Each payment reaches the neuron as three inputs:
| input | what it measures |
|---|---|
| the amount, in hundreds | |
| how many payments the card made in the past hour | |
| if the card has been used at this shop before, otherwise |
The trained neuron has weights , , and bias . A positive output leans towards fraud and a negative one leans towards letting the payment through.
Payments don't arrive one at a time, though. They arrive as a batch, a list of examples handled together, and the neuron has to score every payment in it.
Task: write neuron_forward(batch, weights, bias). It returns the neuron's output
for every example in the batch, as a list, with each value rounded to 4 decimal places.
batch is a list of examples. Each example is a list of input values, in the same order as weights.weights has one entry per input. bias is a single number.Once the first test passes, run the hand-written rule over the same three payments and compare verdicts. The rule and the neuron look at the same facts. What differs is who decided how much each fact counts, and a learned weight can trade one fact off against another in a way a yes-or-no rule never can.