Skip to content

Conversation

@wulfy
Copy link

@wulfy wulfy commented Dec 12, 2025

New article about building a simple neuron in GO.
The goal is to describe basics concepts of a single neuron which is the base of neural networks.

@aws-amplify-eu-west-3
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-478.dsvmt7xpjktgx.amplifyapp.com

Copy link
Contributor

@pmartin pmartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general comment: in markdown, line breaks do not translate to line breaks in the output.

You need either an empty line to create a new paragraph, or two spaces at the end of a line to create a line break.


It uses "deep learning concept" in "machine learning".
To do so I will guide you with an example in GO running in a Google Colab environment.
Why go? Because when we talk about AI, most of the time you have code in python but we hardly use GO at Bedrock.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"we hardly use GO" → are you sure this means what you want? I understand this as "nous utilisons à peine Go", which I don't think is what you meant?

Deep learning is a part of the AI family.
![deep-learning](/images/posts/2025-10-10-AI-neural-in-go-on-collab/deep-learning.png)

I will not give a detailed definition about IA or machine learning, because it's not the purpose of this article.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
I will not give a detailed definition about IA or machine learning, because it's not the purpose of this article.
I will not give a detailed definition about AI or machine learning, because it's not the purpose of this article.

I will not give a detailed definition about IA or machine learning, because it's not the purpose of this article.
I will just give some definitions about AI and machine learning to help understanding what lies behind these terms.

**AI**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list of definitions needs reformating: it is currently displayed as a single paragraph.


As you can see, what we recently call "AI" (LLM and image generation) are a small part of AI. Their common point is learning by minimizing an error which looks like the way humans learn but in fact it's slightly different.
Modern AI are using different "systems" to encode input and learn how to find the right solution.
This post will focus on the base of the system : how it computes an output from an input?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This post will focus on the base of the system : how it computes an output from an input?
This post will focus on the base of the system : how does it compute an output from an input?

Of course there is several easy ways to resolve it and maybe you will use mathematics to find these solutions.
But don't forget our neuron is "naïve", it does not know anything about maths or equations. It will just learn with the fail/retry method.

### How a neuron "learn"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### How a neuron "learn"
### How a neuron "learns"

Then you have the neuron.go file which describe the neuron model.

```
%%writefile neurone.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code uses neurone.go but the text before it says neuron.go

![colab](/images/posts/2025-10-10-AI-neural-in-go-on-collab/run_code_icon.png)

### Results
for each runned part, you will get an output.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for each runned part, you will get an output.
For each part run, you will get an output.

### Results
for each runned part, you will get an output.

for neurone.go file you'll have a message to confirm the file creation (or overwrite if you already loaded it)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for neurone.go file you'll have a message to confirm the file creation (or overwrite if you already loaded it)
For `neurone.go` file you'll have a message to confirm the file creation (or overwrite if you already loaded it)


If you try it: 1*0.06826215000443395 + 2*1.4283067951201867 + 2.07460060154341 and you get 4,999476341788217 🎉

You can also see the "loss" decreasing during the learning phase : The more the neuron learn the less the value of the loss is and the more the accuracy is !
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can also see the "loss" decreasing during the learning phase : The more the neuron learn the less the value of the loss is and the more the accuracy is !
You can also see the "loss" decreasing during the learning phase: the more the neuron learns, the less the value of the loss is and the more the accuracy is !

## 👨🏻‍🏫 Conclusions
As you can see, a neuron can learn without any knowledge, just by giving it data and applying mathematical concepts to make it "learn".
If you launch multiple times the learning process, you may find a different result (because initial values may vary).
In fact, this example is useless in the real world because we can resolve the problem by ourselves. This is why "neural networks", used in most AI like text generation, image detection or generation, are using thousand of neuron!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thousands?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants