# Financial Context News Sentiment Analysis for the Lithuanian Language
## 3 Supervised Machine Learning Model
### Classification Algorithms and Their Quality Estimation  
As above-mentioned, in this paper we chose two of the most commonly used traditional machine learning algorithms--Naive Bayes, a support vector machine (SVM), and one deep learning algorithm, a long short-term memory (LSTM). The related review \begin{table}
\begin{tabular}{c c} \hline \hline
**Description 1** & **Sentiment Score** \\ \hline Absolute proportional difference. & \(\frac{P-N}{P+N+O}\) & (1) \\ The score falls in the interval [0, 1]. & \(\frac{P-N}{P+N}\) & (2) \\ Logistic scales. & \(\log(P+0.5)-\log(N+0.5)\) & (3) \\ The score falls in the interval \((-\infty,+\infty)\). & \(\log(P+0.5)-\log(N+0.5)\) & (3) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Sentiment scores. Figure 4: The distribution of dataset (automatic and manual sentiment assignment) and confusion matrix. showed that these algorithms are suitable for sentiment analysis. Naive Bayes is a classification algorithm that applies density estimation to the data. The base of this algorithm is a [PERSON] theorem, where it naively assumes that the predictors are conditionally independent of the given class [27]. In our research, we used a multinomial Naive Bayes algorithm. The multinomial distribution is appropriate for a predictor whose observations are categorical. Naive Bayes classifiers assign dataset items to the most probable class using these steps: (1) estimate the densities of the predictors in each class; (2) model finds probabilities according to Bayes rule; (3) dataset item classification by estimating the probability for each class, and after, it assigns the dataset item to the class where the obtained probability is the highest. A support vector machine is a supervised machine learning algorithm [28]. The main aim of the algorithm is to find an optimal boundary (hyperplane) between the possible outputs, it can help in the classification or regression tasks. Generally, the SVM does not support multiclass classification and it can deal just with binary classification, to separate dataset items into two classes. For multiclass tasks, the same principle is used, when the multiclass classification problem is split into multiple binary classification problems, the so-called \"one-vs.-one\" and \"one-vs.-rest\" methods can be used. Both methods are heuristic. Using the one-vs.-rest method, a binary classifier is trained on each binary classification problem and predictions are made using the model that is the most confident. The main issue of this method that the model has to be created for each class separately, so then the model can be slow and have problems when a dataset is large or have a very big number of classes. Unlike one-vs.-rest, the one-vs.-one approach splits the dataset into one dataset for each class versus every other class. Each binary classification model can predict one class and the model with the most predictions is predicted by the one-vs.-one method. The various parameters, such as kernel scale or function, can influence the SVM classification results. A recurrent neural network (RNN) [29] is one of the artificial neural network (ANN) types that uses past information to improve the network performance of current and future inputs. The difference between RNN and other types of ANN, where the network contains a hidden state and loops, which allows the network to store past information in the hidden state and operate on sequences, makes the RNN unique. Over time, many algorithms based on RNN modifications showed up; one commonly used is long short-term memory [30]. The main problem of RNN, in practice, is with learning long-term dependencies, because recurrent neural networks are usually trained through the backpropagation method, so it can deal with vanishing or exploding gradient problems. In other words, the network weights can become very small or very high, so it limits and distorts the effectiveness of the learning process.