# Decision Support Using Machine Learning Indication for Financial Investment
## 4 Development
### ANN Implementation  
The ANN was implemented using Sklearn's MLPClassifier, which is a neural network that is intended to work with classification problems. The Activation Function used in the Hidden Layers is ReLu, which has no negative part, presenting a set of outputs between zero and infinity. Here, zero represents the neuron as deactivated, and values greater than zero represent activation of the neuron [65]. To define the configuration of the Artificial Neural Net parameters, tests were performed using Sklearn's GridSearchCV function, which is basically used to automate the process of adjusting the parameters of a given algorithm, performing several combinations of parameters, and evaluating each configuration to obtain the one that presents the best results.  
The number of neurons in the two hidden layers was defined through the parameter \"hidden_layers_sizes\", the Learning Rate was defined through the parameter \"learning_rate_init\", and the Number of epochs was defined through the parameter \"max_iter\". After running GridSearchCV, the best parameters were obtained through the method \"grid_best_params\", being them: 4 neurons in the first hidden layer, 3 neurons in the second hidden layer, learning rate of 0.01 and number of epochs of 1000.  
After defining the settings of the ANNs, the tests were performed using the 2014-2019 database. The Accuracy obtained with the model was 74%. Data classified as \"1\" obtained an accuracy of 0.74, recall of 0.96 and F1-score of 0.84. However, data classified as \"0\" obtained a precision of 0.72, recall of 0.22, and F1-score of 0.34. In other words, among the data that should be classified as \"0\", only 22% was actually classified as \"0\". Considering that the label \"0\" represents a Stock that is not indicated as a good investment option,having a recall of only 0.22 indicates that the algorithm is classifying 78% of the stocks that should not be indicated as a good investment option as being a good investment option. This negatively influences the decision making of an investor who might use the algorithm to help decide, causing him to invest in a stock that should not be classified as a good investment choice.  
At first, a database containing 1021 stock records from 2014 to 2019 was used. However, the Oceans14 website [62], from where the data were collected, contains records since 1998. Therefore, to perform further tests and to test the algorithms, tests were performed using the database containing the Fundamentalist Stock Indicators since 1998. With the insertion of data since 1998, the database has 2627 records, of which 1231 have the label \"0\" and 1396 have the label \"1\". After training and testing the ANNs using the database with records from 1998 to 2019, a report was generated with the main classification metrics. Figure 3 shows the metrics of the ANNs using the database from 1998 to 2019.  
In the metrics presented in Figure 3, the Accuracy obtained with the model was 69%. Data classified as \"1\" obtained an accuracy of 0.72, recall of 0.69 and F1-score of 0.71. Data classified as \"0\" obtained a precision of 0.66, recall of 0.68 and F1-score of 0.67. Figure 4 shows the Confusion Matrix of the ANNs.  
In the Confusion Matrix presented in Figure 4, it is shown that data labeled as \"1\" are 69% correctly classified. The data labeled as \"0\" obtained 68% correct classification.