用Python从头开始神经网络 Neural network from scratch in python
This story introduces building a neural network from scratch in Python, starting with the XOR dataset. The network architecture includes two inputs, one hidden layer with three neurons, and two output neurons. The process involves forward propagation (dot product of inputs and weights followed by a sigmoid function) and backpropagation for updating weights. The training is repeated for a certain number of epochs to minimize error. The article concludes with a brief overview of the code and the next steps involving convolutional neural networks.
In the previous story, we delved into neural networks and their mathematics , marking the foundation for this narrative. In this story, we will embark on constructing a neural network from scratch using Python.
Let’s get started!!!!!! 让我们开始吧!!!!!!

首先,我们采用最简单的数据集,即异或表。首先考察最简单的数据集,即异或表。

2.配置网络结构并设置权重参数

Here we have two input variables X₁ and X₂, a hidden layer consisting of 3 neurons, and an output layer with 2 neurons. When the network is initialized, its structure will be presented as follows.
我们有两个输入变量X₁和X₂,一个隐藏层包含3个神经元,输出层包含2个神经元。当我们初始化该网络时,其结构将呈现为

3. we apply the forward propagation algorithm,
3.我们应用前向传播算法,
When we use numpy arrays, it's merely the dot product of inputs and weights, and then we apply the sigmoid function. We perform this operation for every neuron in every layer.
当我们使用numpy数组时,它只是输入与权重的点乘,然后我们应用sigmoid函数。我们对每一层的每一个神经元执行此操作。

4. 如上所述,我们采用了反向传播的方法。

For updating weights 用于更新权重

5. Repeat the process for certain no of epochs.
5. 对一定的纪元重复该过程。

After the training process has been successfully completed, the neural network has learned weights through the learning process by minimizing the error term.

Well, that’s it. 嗯,就是这样。
Next step is prediction 下一步是预测
It is possible to simply call the forward propagation method to predict.

See that works!! 看看效果如何!
This marks the conclusion of this story. May you both enjoy and learn something, and feel free to reach out if it proved helpful.
You are able to locate the complete code on my GitHub. Please visit my GitHub to obtain the complete code.
In the upcoming narrative, I will explore one of the key algorithms in deep learning, specifically the ** Convolutional neural networks.**.
