How Calculations Happen in a Neural Network

●1 ●35 ●98
calendar_today • schedule1 min read
— Originally published at dev.to

Hello, I'm Ganesh. I'm building git-lrc, an AI code reviewer that runs on every commit. It is free, unlimited, and source-available on GitHub. Star git-lrc on GitHub to help more developers discover the project. Do give it a try and share your feedback for improving the product.

In the previous article, we discussed how action potentials are defined.

Let's take a simple example and plot a graph.

Using Softplus as the Activation Function

For our initial example of dosage, we can take Softplus as an activation function.

Now let's find the dosage and y values based on the formula:

( Dosage x -34.4 ) + 2.14

For dosage : 0
( 0 x -34.4 ) + 2.14 = 2.14

For dosage : 0.1
( 0.1 x -34.4 ) + 2.14 = -3.44 + 2.14 = -1.3

Now let's multiply all the values calculated in the top-most hidden layer with -1.3.

For dosage : 0
2.14 x -1.3 = -2.782

For dosage : 0.1
-1.3 x -1.3 = 1.69

Similar calculations can be done for the top-most node values.

Calculating the Bottom Node

Now for the bottom-most node:

( Dosage x -2.52 ) + 1.29

For dosage : 0
( 0 x -2.52 ) + 1.29 = 1.29

For dosage : 0.1
( 0.1 x -2.52 ) + 1.29 = -0.252 + 1.29 = 1.038

Now multiply all the values calculated in the bottom-most hidden layer with 2.28.

For dosage : 0
1.29 x 2.28 = 2.94

For dosage : 0.1
1.038 x 2.28 = 2.366

Combining Both Node Results

From both the top and bottom node results, we add them together.

Finally, we subtract 0.5690 from the final value.

Here is the final prediction made by the neural network.

Weights Used in the Neural Network

These are the weights:

Bias Values Used in the Neural Network

These are the bias values:

Support git-lrc

git-lrc

Any feedback or contributors are welcome! It’s online, source-available, and ready for anyone to use.

⭐ Star git-lrc on GitHub

Want more #rel="noopener & #values deep dives?

Join 6,181+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

How I Built a React Portfolio in 7 Days That Landed ₹1.2L in Freelance Work

Dharanidharan - Feb 9

Hamiltonian Neural Networks: Physics as Inductive Bias

berkansesenverified - Nov 29

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Why Do Neural Networks Need the Chain Rule? How do we apply it?

Ganesh Kumar - Jul 3

Understanding Multiple Input and Output Neural Network

Ganesh Kumar - Jul 15
chevron_left
1.5k Points • 134 Badges
68Posts
6Comments
5Connections
Right now I'm focused on LiveReview, AI code review that gives teams control over AI-generated code without slowing them down.

Related Jobs

View all jobs →

Commenters (This Week)

5 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!