mirror of
https://github.com/guezoloic/neural-network.git
synced 2026-01-25 10:34:22 +00:00
feat: write ai introduction
This commit is contained in:
@@ -15,20 +15,42 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"## What is a *Neuron* (artifical)\n",
|
"## What is a *Neuron* (artifical)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"First of all, **I'm not an Neurologist so i might say some nonsense, i only researched online**. \n",
|
"> **disclaimer**: I'm not an Neurologist. This is only based on online research.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"An artifical *neuron* works similary to a biological *neuron* in the way it process information. In a brain, like yours, a *neuron* receives signals from other *neurons*, processes them and sends an *output*.\n",
|
"An **artificial neuron** works *similary* to a **biological neron** in the way it process information.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"An artifical *neuron* takes an **input** (such as numbers), applies updated values called **weights** to each *inputs*, adds a constant called **bias**, apply a specific function to normalize the value called **Activation function**, and then `returns` the *output* of the Activation function (such as: **sigmoid**, **ReLU**, etc...).\n",
|
"In a brain, like yours, a neuron receive **electrical signals** from others, process them and sends an output signal.\n",
|
||||||
|
"\n",
|
||||||
|
"An **artifical neuron** countrary to biological ones:\n",
|
||||||
|
"1. **Takes inputs** (usually numbers between 0 and 1).\n",
|
||||||
|
"2. **Multiplies** each by a corresponding **weight** (importance of that input).\n",
|
||||||
|
"3. **Adds a bias**, which shifts the result up or down.\n",
|
||||||
|
"4. **Applies an activation function**, which normalizes or squashes the output (commonly: **sigmoid**, **ReLU**, etc.).\n",
|
||||||
|
"5. **Returns the final output**, often a value between 0 and 1. \n",
|
||||||
|
"\n",
|
||||||
|
"---\n",
|
||||||
"\n",
|
"\n",
|
||||||
"## Vocabulary / key components\n",
|
"## Vocabulary / key components\n",
|
||||||
"\n",
|
|
||||||
"1. **inputs**: inputs are usually a unique list of numbers, they are simply values sent to a neuron, which then process them.\n",
|
"1. **inputs**: inputs are usually a unique list of numbers, they are simply values sent to a neuron, which then process them.\n",
|
||||||
"\n",
|
|
||||||
"2. **weights**: weights are also a list of numbers that has the same size of inputs. The weight determines how important de the number of the input is. If it's high, the input matters. Else, if the weight is low, the number matters less.\n",
|
"2. **weights**: weights are also a list of numbers that has the same size of inputs. The weight determines how important de the number of the input is. If it's high, the input matters. Else, if the weight is low, the number matters less.\n",
|
||||||
"\n",
|
|
||||||
"3. **bias**: the bias are constant that are added after all the inputs are multiplied by the weight. it helps shift the resultat up or down.\n",
|
"3. **bias**: the bias are constant that are added after all the inputs are multiplied by the weight. it helps shift the resultat up or down.\n",
|
||||||
"\n"
|
"\n",
|
||||||
|
"---\n",
|
||||||
|
"\n",
|
||||||
|
"## 🔑 Vocabulary / Key Components\n",
|
||||||
|
"\n",
|
||||||
|
"| Term | Meaning |\n",
|
||||||
|
"|----------|---------|\n",
|
||||||
|
"| **inputs** | List of input values (e.g., 8-bit binary numbers like `01001010`) |\n",
|
||||||
|
"| **weights** | Values associated with each input, controlling how much influence each input has |\n",
|
||||||
|
"| **bias** | A constant added to the weighted sum to adjust the output |\n",
|
||||||
|
"| **activation function** | A function like `sigmoid` that transforms the output into a bounded range |\n",
|
||||||
|
"\n",
|
||||||
|
"---\n",
|
||||||
|
"\n",
|
||||||
|
"## ⚙️ Minimal Neuron Implementation\n",
|
||||||
|
"\n",
|
||||||
|
"### Step 1 – Initialization"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -40,14 +62,28 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"import random\n",
|
"import random\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Neuron 1\n",
|
"# neuron class\n",
|
||||||
"class Neuron:\n",
|
"class Neuron:\n",
|
||||||
" def __init__(self, input_size: int) -> None:\n",
|
" \"\"\"\n",
|
||||||
" self.input_size = input_size\n",
|
" z : linear combination of inputs and weights plus bias (pre-activation)\n",
|
||||||
" self.weight = [random.uniform(0, 1) for _ in range(self.input_size)]\n",
|
" y : output of the activation function (sigmoid(z))\n",
|
||||||
" self.bias = random.uniform(0, 1)"
|
" w : list of weights, one for each input\n",
|
||||||
|
" \"\"\"\n",
|
||||||
|
" def __init__(self, isize):\n",
|
||||||
|
" # number of inputs to this neuron\n",
|
||||||
|
" self.isize = isize\n",
|
||||||
|
" # importance to each input\n",
|
||||||
|
" self.weight = [random.uniform(-1, 1) for _ in range(self.isize)]\n",
|
||||||
|
" # importance of the neuron\n",
|
||||||
|
" self.bias = random.uniform(-1, 1)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "6dd28c51",
|
||||||
|
"metadata": {},
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "1aff9ee6",
|
"id": "1aff9ee6",
|
||||||
@@ -177,4 +213,3 @@
|
|||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 5
|
"nbformat_minor": 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user