Feedforward Neural Networks
Inspiration for artificial neural networks
Artificial neural networks are biologically inspired algorithms that try to roughly imitate how neurons in the human brain work.

A synapse, which is the point of communication between two biological neurons, can either enhance or inhibit the signal that passes through it. A biological neuron fires, i.e., transmits a signal to other neurons, if its incoming signal exceeds a certain threshold. This type of operation is adapted to artificial neural networks.
Feedforward neural network
The simplest artificial neural networks are feedforward neural networks (FNN), where information flows only in the forward direction and there are no feedback loops from the opposite direction to previous layers. Nodes (neurons) are organized into layers, as can be seen in the following figure.

The dimension of the input data determines the number of neurons in the input layer. The output layer has as many nodes as the problem to be solved by the neural network requires. To use a simple example, we want to train a neural network to detect whether an image (input: pixels of the image) contains cats (output: 1=yes, 0=no).
Two examples of feedforward networks are single-layer and multi-layer perceptrons.
Single-layer perceptron
The first and basic model of neural networks is the single-layer perceptron, which has no hidden layers, only input and output nodes exist. Connections between them have different weights (from w₁ to wₙ), which play the role of synapse in neurons, exciting or inhibiting the incoming signal. A bias value (b₁) is added to the sum of the weighted inputs, and this result (∑) is passed through an activation function (f).

y₁ = f(x₁⋅w₁ + x₂⋅w₂ + ... + xₙ⋅wₙ + b₁)
Using binary step activation function f, the final output is 0 or 1:
f(x) = { 1 if x ≥ 0,
0 if x < 0 }
This results in a linearly separable function, which means that the perceptron model makes the classification decision based on the value of a linear combination of features. For example, a perceptron is able to learn how to separate two groups (Class 1 and Class 2) by the red line, considering only two features x₁ and x₂. These classes can be, for example, different animals with features such as height, width, mass etc.

However, this model has huge limitations in complex problems. For instance, this architecture is not able to learn how to separate the classes below with only one straight line. This kind of problem can be solved by the following multi-layer perceptrons.

Multi-layer perceptron (MLP)
MLP contains one or more hidden layers and non-linear activation functions to solve problems with linearly non-separable data.

The input layer receives the input and carries the information from the input layer to the hidden layer. Activation functions (f) of the hidden layer decide which neuron should be activated. The value computed from the activation function acts as input to the output layer.
Training a neural network
Training set
Feedforward neural networks in supervised learning estimate the mapping from inputs to outputs. Ideally, the network learns better functions by iteratively adjusting its weights and biases as training examples are fed in. A training set contains input and output pairs (x⁽¹⁾, y⁽¹⁾), (x⁽²⁾, y⁽²⁾), ..., (x⁽ⁱ⁾, y⁽ⁱ⁾), ..., (x⁽ᵐ⁾, y⁽ᵐ⁾), where (x⁽ⁱ⁾, y⁽ⁱ⁾) is the i-th sample. x⁽ⁱ⁾ is the input or feature vector, y⁽ⁱ⁾ is the desired output or label. The mapping learned by the network is only an estimation, ŷ⁽ⁱ⁾ is called the prediction for the i-th input sample, which depends on the current weights and biases of the network.
Cost function
During training, only the input vectors of the training set are presented to the neural network. Based on its current knowledge, it predicts an output value for each input. We would like to measure the performance of the neural network, therefore we can compare the expected outputs y⁽ⁱ⁾ from the training set to the predicted values ŷ⁽ⁱ⁾. The cost function is used for this purpose that has different types designed to specific problems. Two main groups are functions for regression and classification tasks.
Building a model to predict house prices based on various factors (e.g. location, number of bedrooms, etc.) is a regression problem. The Mean Squared Error (MSE) is a commonly used cost function that calculates the errors between the true output (known price) and the predicted output (predicted price) for each input-output pair and takes the average of these squared error values:
J(w,b) = ⅟ₘ ∑ (y⁽ⁱ⁾-ŷ⁽ⁱ⁾)²,
where y⁽ⁱ⁾ is the known expected output value for input x⁽ⁱ⁾,
ŷ⁽ⁱ⁾ is the predicted output for input x⁽ⁱ⁾ from the neural network,
m is the number of samples,
and the sum goes from i=1 to m.
Gradient descent
The aim is to minimize this cost value during training, i.e., to create predictions that are close to the true outputs. The gradient descent optimization algorithm finds the local minimum of the cost function by iteratively moving in the direction of the steepest descent at the current point. An illustration of this mechanism is shown below.

The value of the cost function J(w,b) depends on the weights and biases of the neural network. We can calculate the gradient of the cost function relative to the weights and biases, and then update the network values through the gradient descent process to get better predictions.
At the end of the training, when the value of the cost function is close to zero, we have a trained feedforward neural network that can make good predictions not only for the trained examples but also for new input data that it has not seen before.
Conclusion
Now you know the basics of feedforward neural networks and how they are trained. More details on activation functions, cost functions and optimization algorithms will come in the next article. Stay tuned and Join WAI!
In the meantime, what other predictions could neural networks be used for besides the task of predicting house prices? Please leave your comment below!




sunwin khiến mình quan tâm đến cách một trò chơi thể hiện nhịp độ qua từng lượt tương tác. Với bắn cá 3D, sự xuất hiện của các nhóm cá có kích thước khác nhau tạo nên một không gian quan sát nhiều lớp, trong đó những mục tiêu lớn thường thu hút sự chú ý hơn. Mình thấy việc phân biệt mục tiêu giúp người xem dễ hình dung cách lựa chọn hướng bắn và điều chỉnh nhịp chơi. Đến phần câu hỏi thường gặp, nội dung lại được tổ chức theo những vấn đề liên quan đến thao tác sử dụng. Sự chuyển đổi này khá hợp lý vì mỗi khu vực đều giữ được trọng tâm riêng, không…
MM88 tạo cho mình ấn tượng qua cách phân chia các liên kết thông tin ở phần Về chúng tôi. Mình thường chú ý những mục như Giới Thiệu, Liên Hệ, Điều Khoản Điều Kiện và Chính Sách Bảo Mật vì chúng phản ánh cách website tổ chức nội dung hỗ trợ bên cạnh các danh mục chính. Việc đặt những đường dẫn này trong cùng một khu vực giúp mình dễ nhận biết đâu là thông tin về thương hiệu, đâu là nội dung liên quan đến quy định sử dụng. Đây là chi tiết không quá nổi bật nhưng góp phần tạo nên bố cục có trật tự.
LLwin được tôi tiếp cận khi muốn đánh giá cách hiển thị những thay đổi bất thường trong quá trình cập nhật dữ liệu. Tôi lựa chọn Thể thao, Đá gà và Xổ số để xem xét cách phân biệt sự kiện bị hoãn, thông tin chưa hoàn chỉnh và kết quả đã công bố. Những trường hợp chưa có dữ liệu cần được giải thích bằng thông báo cụ thể thay vì để trống. Tôi cũng quan tâm đến khả năng nhận diện thời điểm cập nhật gần nhất khi mở lại một chuyên mục. Các nhãn trạng thái cần sử dụng cách diễn đạt thống nhất giữa những khu vực khác nhau. Theo tôi, thông tin rõ ràng giúp…
rr88 là nền tảng tôi tìm hiểu trong bối cảnh đánh giá sự thống nhất của nội dung tiếng Việt. Các thuật ngữ xuất hiện trong Nổ hũ và Live Casino có thể được diễn đạt bằng nhiều cách khác nhau. Tôi đối chiếu tên gọi trong phần giới thiệu với những chú thích thuộc tài liệu hướng dẫn. Khi một khái niệm sử dụng đồng thời tiếng Anh và tiếng Việt, phần giải thích cần duy trì ý nghĩa nhất quán. Tôi cũng quan tâm đến cách trình bày từ viết tắt trên màn hình nhỏ. Sự chính xác về ngôn ngữ là tiêu chí đánh giá của tôi.
hitclub là nội dung tôi tìm hiểu từ góc nhìn đánh giá khả năng trình bày thông tin bằng hệ thống biểu tượng. Tôi quan tâm đến việc mỗi biểu tượng có ý nghĩa rõ ràng và được sử dụng thống nhất giữa các khu vực hay không. Với Bắn cá, Xì tố và Mini game, tôi xem xét yêu cầu phân biệt ký hiệu hướng dẫn, thông báo và những thành phần chỉ mang tính minh họa. Nếu một biểu tượng đảm nhiệm nhiều chức năng khác nhau, người đọc có thể hiểu sai ý nghĩa khi chuyển mục. Tôi cũng chú ý đến khả năng nhận diện biểu tượng trên màn hình có độ phân giải thấp. Với tôi,…