Reader small image

You're reading from  MATLAB for Machine Learning - Second Edition

Product typeBook
Published inJan 2024
Reading LevelIntermediate
PublisherPackt
ISBN-139781835087695
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
Giuseppe Ciaburro
Giuseppe Ciaburro
author image
Giuseppe Ciaburro

Giuseppe Ciaburro holds a PhD and two master's degrees. He works at the Built Environment Control Laboratory - Università degli Studi della Campania "Luigi Vanvitelli". He has over 25 years of work experience in programming, first in the field of combustion and then in acoustics and noise control. His core programming knowledge is in MATLAB, Python and R. As an expert in AI applications to acoustics and noise control problems, Giuseppe has wide experience in researching and teaching. He has several publications to his credit: monographs, scientific journals, and thematic conferences. He was recently included in the world's top 2% scientists list by Stanford University (2022).
Read more about Giuseppe Ciaburro

Right arrow

Introducing Artificial Neural Network Modeling

Artificial neural networks (ANNs) include data structures and algorithms for learning and classifying data. Through neural network techniques, a program can learn through examples and create an internal structure of rules to classify different inputs. MATLAB provides algorithms, pre-trained models, and apps to create, train, visualize, and simulate ANNs. In this chapter, we will see how to use MATLAB to build an ANN-based model to predict values and classify data.

In this chapter, we’re going to cover the following main topics:

  • Getting started with ANNs
  • Training and testing an ANN model in MATLAB
  • Understanding data fitting with ANNs
  • Discovering pattern recognition using ANNs
  • Building a clustering application with an ANN
  • Exploring advanced optimization techniques

Technical requirements

In this chapter, we will introduce basic concepts relating to machine learning. To understand these topics, a basic knowledge of algebra and mathematical modeling is needed. You will also need a working knowledge of the MATLAB environment.

To work with the MATLAB code in this chapter, you need the following files (available on GitHub at https://github.com/PacktPublishing/MATLAB-for-Machine-Learning-second-edition):

  • ANNFitting.m
  • ANNPatReg.m

Getting started with ANNs

Serial computers and their programs exhibit remarkable capabilities in executing tasks that involve repetitive, well-defined operations, prioritizing accuracy, reliability, and speed. While these information-processing systems are highly valuable, they lack true intelligence. The sole element of intelligence lies with the programmer who comprehends the task and formulates the program. To achieve true artificial intelligence (AI), a system must possess the ability to solve problems that humans consider simple, trivial, and intuitive.

Basic concepts relating to ANNs

ANNs are designed to emulate the intricate workings of biological nervous systems, comprising a vast array of nerve cells or neurons interconnected in a complex network. Typically, each neuron establishes connections with tens of thousands of other neurons, resulting in hundreds of billions of connections. The emergence of intelligent behavior stems from the myriad interactions among these...

Training and testing an ANN model in MATLAB

In the previous section, we saw the architecture of an ANN. It imposes two layers, input and output, which cannot be altered. Consequently, the critical factor lies in the number of hidden layers we consider. The size of a neural network is defined by the number of hidden neurons. Determining the optimal size of the network remains an ongoing challenge, as no analytical solution has been discovered to date. One approach to tackle this problem is to employ a heuristic method: creating various networks with increasing complexity, using a subset of the training data, and monitoring the error on a validation subset simultaneously. After completing the training process, the network with the lowest validation error is chosen as the preferred one.

How to train an ANN

Let’s discuss the process of choosing the number of layers. The number of input nodes is fixed based on the number of features in the input data, while the number of output...

Understanding data fitting with ANNs

Data fitting is the process of constructing a curve or mathematical function that best matches a given set of collected data points. This curve fitting can involve either interpolations, where exact data points are fitted, or smoothing, where a smooth function approximates the data. In the context of regression analysis, curve fitting is closely related to statistical inference, considering uncertainties arising from random errors in observed data.

The approximate curves obtained through data fitting have multiple applications. They can be used to visualize and display the data, predict function values in regions with no available data, and summarize the relationships between multiple variables. This process is valuable for understanding and interpreting complex datasets, making predictions, and gaining insights from the collected information.

Predicting the trend of a particular distribution using mathematical formulas can be challenging...

Discovering pattern recognition using ANNs

Pattern recognition is a branch of machine learning and AI that focuses on the identification of patterns or regularities in data. It involves the automatic discovery and extraction of meaningful information from datasets, with the aim of categorizing or classifying data into different classes or groups. Overall, pattern recognition plays a crucial role in automating the process of identifying patterns and making decisions based on data, making it a fundamental component of many modern AI systems.

Pattern recognition offers numerous benefits in automating decision-making and handling complex data. However, it also poses challenges related to data quality, interpretability, and computational requirements. To leverage its advantages effectively, practitioners need to carefully design and train models while being aware of potential limitations and biases in the data and algorithms.

The classical approach to pattern recognition uses data...

Building a clustering application with an ANN

Clustering is a popular unsupervised machine learning technique used for grouping similar data points together in a dataset. The goal of clustering is to partition data into clusters in such a way that data points within the same cluster are more like each other than those in other clusters. We examined this topic in depth in Chapter 4, Clustering Analysis and Dimensionality Reduction.

In this section, we will see how to address a clustering problem using an ANN in the MATLAB environment. So far, to train a neural network in the MATLAB environment, we have used the commands available from the command line, or much more simply to be implemented in a script with the .m extension to reproduce the algorithm whenever we like. But MATLAB has out-of-the-box apps that let us use a wizard to train an ANN. We will do this to address a clustering problem as follows:

  1. To get an overview of the apps made available by the Neural Network tool...

Exploring advanced optimization techniques

Advanced optimization techniques are powerful methods used to enhance the efficiency and effectiveness of optimization algorithms. These techniques aim to overcome the limitations of traditional optimization approaches, particularly in complex, high-dimensional, or non-convex optimization problems.

In machine learning, advanced optimization techniques are essential for training complex models effectively, improving convergence, avoiding overfitting, and handling high-dimensional data. In the following subsection, some advanced optimization techniques commonly used in machine learning are listed.

Understanding SGD

SGD is a popular and fundamental optimization algorithm used in machine learning for training models, especially in large-scale and complex settings. It’s a variant of the traditional gradient descent method designed to address efficiency and convergence issues when dealing with large datasets. The stochastic aspect...

Summary

In this chapter, we gained insight into simulating typical human brain activities using ANNs. We grasped the fundamental concepts behind ANNs, delving into the creation of a basic neural network architecture. This exploration encompassed elements such as input, hidden, and output layers, connection weights, and activation functions. Our understanding extended to crucial decisions regarding hidden layer count, node quantity within each layer, and network training algorithms.

Then we focused on data fitting and pattern recognition using neural networks. We engaged in script analysis to master the utilization of neural network functions via the command line. We then ventured into the Neural Network Toolbox, featuring algorithms, pre-trained models, and apps for crafting, training, visualizing, and simulating shallow and deep neural networks. The Neural Network Toolbox offers an accessible interface—the Neural Network getting started GUI—which serves as the launchpad...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
MATLAB for Machine Learning - Second Edition
Published in: Jan 2024Publisher: PacktISBN-13: 9781835087695
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Giuseppe Ciaburro

Giuseppe Ciaburro holds a PhD and two master's degrees. He works at the Built Environment Control Laboratory - Università degli Studi della Campania "Luigi Vanvitelli". He has over 25 years of work experience in programming, first in the field of combustion and then in acoustics and noise control. His core programming knowledge is in MATLAB, Python and R. As an expert in AI applications to acoustics and noise control problems, Giuseppe has wide experience in researching and teaching. He has several publications to his credit: monographs, scientific journals, and thematic conferences. He was recently included in the world's top 2% scientists list by Stanford University (2022).
Read more about Giuseppe Ciaburro