← Back to list

Artificial Neural Networks (ANNs) and Their Role in Machine Learning

Artificial Neural Networks (ANNs) are a powerful machine learning technique inspired by the structure and function of biological neural…

Prasan N H · 2024-10-11 17:48 · 1 claps · 4.2 min read
#artificial-neural-network #neural-networks #hidden-layers #activation-functions #embedding-layer
Open on Medium ↗
Wiki topics: RAG · RAG & Retrieval ML · Machine Learning BIO · Biology · General EDU · Education & Learning

Artificial Neural Networks (ANNs) and Their Role in Machine Learning

Artificial Neural Networks (ANNs) are a powerful machine learning technique inspired by the structure and function of biological neural networks in the human brain. They are designed to approximate complex, nonlinear functions, enabling machines to learn from data and make decisions or predictions based on patterns.

Structure of Artificial Neural Networks (ANNs)

At the core of ANNs are elementary units called neurons (also referred to as nodes or units). These neurons are arranged into layers, which can be broken down into the following categories:

  • Input Layer: Receives raw data inputs.
  • Hidden Layers: These intermediate layers process the data by applying weights and biases through mathematical functions. An ANN with multiple hidden layers is referred to as a deep neural network (DNN).
  • Output Layer: Produces the final prediction or classification result.

The ANN model will learn a weight for each connection between the ‘artificial neural units’ across the successive layers of the network.

The ANN model will learn a weight for each connection between the ‘artificial neural units’ across the successive layers of the network.

Each connection between neurons has an associated weight, and each neuron has a bias term. By adjusting these weights and biases during training, the network learns to make better predictions. In a feedforward network, information flows from the input layer through successive hidden layers to the output layer. This flow involves transforming inputs via matrix multiplication with learned weights, followed by applying an activation function in each layer.

Mathematics Behind ANNs

Each artificial neuron performs a linear combination of its inputs:

Unit = Node = Neuron = a single Artificial Neuron

Unit = Node = Neuron = a single Artificial Neuron

𝑧 = 𝑤 1 𝑥 1 + 𝑤 2 𝑥 2 + . . . + 𝑤 𝑛 𝑥 𝑛 + 𝑏

Here, 𝑥 1 , 𝑥 2 , . . . , 𝑥 𝑛 are the inputs, 𝑤 1 , 𝑤 2 , . . . , 𝑤​ are the associated weights, and 𝑏 is the bias term.

The result, 𝑧, is then passed through an activation function, which introduces non-linearity into the model. Some popular activation functions include:

  • ReLU (Rectified Linear Unit): Outputs max ( 0 , 𝑧 )
  • Sigmoid: Outputs values between 0 and 1, useful for binary classification tasks.
  • Tanh: Similar to sigmoid, but outputs between -1 and 1.

The final output from each neuron is used as input for the neurons in the next layer, and the process continues until the output layer produces the final result. While a single neuron can be represented using vector arithmetic, entire layers of neurons are represented using matrix operations. For example, an entire layer of neurons can be expressed as:

𝑍 = 𝑋 𝑊 + 𝑏

Where 𝑋 is the input matrix, 𝑊 is the weight matrix, and 𝑏 is the bias vector. This matrix representation allows for efficient computation, especially in deep neural networks with large numbers of neurons and layers.

Matrix arithmetic for multiple units (Tensor): Mathematical representation of an entire ‘single layer’ from a Neural Network. It is a common practice in ANNs to use an identical activation function (like ReLU or sigmoid) for all the individual artificial neural units of the same layer.

Matrix arithmetic for multiple units (Tensor): Mathematical representation of an entire ‘single layer’ from a Neural Network. It is a common practice in ANNs to use an identical activation function (like ReLU or sigmoid) for all the individual artificial neural units of the same layer.

Training an ANN: Weights, Biases, and Backpropagation

Training an ANN involves adjusting the weights and biases to minimize the error between predicted and actual outputs. This process typically uses backpropagation, where errors are propagated backward through the network, and an optimization algorithm such as gradient descent is used to update the weights. The network aims to minimize a loss function (such as mean squared error or cross-entropy) by iteratively adjusting the parameters during training. Over time, the model learns to generalize better to unseen data.

In practice, deeper neural networks (i.e., networks with more hidden layers) tend to perform better at capturing complex patterns in data. This is the essence of deep learning. However, deeper networks can also lead to challenges such as overfitting and underfitting, so it is important to choose the optimal number of layers based on the complexity of the problem and the amount of data available.

Word Embeddings and the Embedding Layer

When dealing with textual data, it must first be converted into a numerical form before being processed by a neural network. Word embeddings are a popular approach for representing text data. An embedding layer in a neural network transforms words or tokens (which are categorical in nature) into continuous dense vectors.

‘Embedding layer’ works like a lookup table for embeddings where text input data is encoded by mapping it to a fixed-length dense vector (lower-dimensional representation compared to OHE vector). The ‘words’ are the keys in this table, while the ‘dense word vectors’ are the values.

‘Embedding layer’ works like a lookup table for embeddings where text input data is encoded by mapping it to a fixed-length dense vector (lower-dimensional representation compared to OHE vector). The ‘words’ are the keys in this table, while the ‘dense word vectors’ are the values.

These embeddings capture semantic information about the words and reduce the dimensionality of the data. Common pre-trained word embeddings include Word2Vec, GloVe, and BERT, which are often fine-tuned during training to better fit the specific task. Initializing the embedding layer with pre-trained embeddings like Word2Vec, GloVe, or BERT can significantly improve performance by:

  • Reducing Training Time: Since the model does not need to learn word representations from scratch.
  • Handling Out-of-Vocabulary (OOV) Words: Pre-trained embeddings are better at dealing with rare or unseen words.
  • Leveraging Transfer Learning: The model can benefit from knowledge learned in other tasks, leading to better generalization.

To create a final representation of a text block, pooling layers are often used in neural networks. Pooling summarizes information from word embeddings by Averaging (Taking the mean value across all word vectors) or Summing (Adding the individual word vectors). This is particularly useful in reducing dimensionality and creating a fixed-size output from varying-length inputs.

‘Pooling’ is a feature extraction layer for representation of text-blocks from ‘word embeddings’ by concatenation (impractical due to high dimensionality), element-wise summing or averaging.

‘Pooling’ is a feature extraction layer for representation of text-blocks from ‘word embeddings’ by concatenation (impractical due to high dimensionality), element-wise summing or averaging.

Artificial neural networks, especially deep learning models, have become the backbone of many advanced NLP tasks, such as: Text Classification (Categorizing documents, sentiment analysis), Machine Translation (Converting text from one language to another), Named Entity Recognition (Identifying key entities in text), Question Answering Systems (Providing answers to natural language queries). By utilizing techniques like word embeddings and deep architectures, ANNs have significantly improved the ability to understand, represent, and generate human language.


메타데이터
post_id
e19a214e46ec
slug
artificial-neural-networks-anns-and-their-role-in-machine-learning-e19a214e46ec
url
https://medium.com/@prasanNH/artificial-neural-networks-anns-and-their-role-in-machine-learning-e19a214e46ec
canonical_url
https://medium.com/@prasanNH/artificial-neural-networks-anns-and-their-role-in-machine-learning-e19a214e46ec
author_url
https://medium.com/@prasanNH
status
ok
fetched_at
2026-07-25 04:43:31