*5.3.2 Naïve Bayes*

The Naïve Bayes algorithm can be used when it is necessary to recognize the user activities in real time [25]. The theorem is based on the Bayes statistical theorem that describes the probability of an event based on conditions or previous knowledge. The "naïve" comes from the naivety of the assumption that the results are independent given the cause [52].

From the Bayes' theorem, we have Eq. (6):

$$P\{A|B\} = \frac{P\{B|A\} \* P\{A\}}{P(B)}\tag{6}$$

where, P(A|B) is the probability that hypothesis A is true given data of type B. P(B|A) is the probability of data B given that hypothesis A was true.

P(A) is the probability that A is true independently of data, and P(B) is the probability of data B regardless of the hypothesis.

The algorithm uses this probability structure to classify at least two independent sets, which can lead to another set of classification or decision and, at the same time, to another independent set.

This algorithm is simple, computationally cost-effective and can be used for small datasets, as it was used to identify activity patterns such as speaking, laughing, and coughing, presenting good results of accuracy [25].

## *5.3.3 Artificial neural networks*

An artificial neural network (ANN) is a technique based on a series of connected inputs and outputs. Its structure resembles neurons, each one connected and with associated weights. The weights represent information being used by the net to solve the problem and can be adjusted as required. The networks can be supervised or not, the fundamental difference is that in supervised learning, the target vectors indicate what is wanted from the network.

For example, the application of an ANN in talking [10, 25] recognition through respiratory patterns [10] is of supervised learning as the targets to classify are provided to the algorithm.

The neural networks can also be more complex, which depends of the problems intricacies. Aiming to recognize activity patterns such as respiratory effort, using a wearable piezo sensor [25] it was applied networks with up to 17 layers and inputs, a very complex ANN, to achieve the best classification.

Overall, the use of machine learning has become increasingly common in health implementations and has proved a very beneficial tool in classifying and recognizing respiratory activities and patterns when combined with wearable sensors [10, 25, 55].
