Elastic Data Frame - Classification Analysis
Tags: machinelearning, elasticsearch, beginners
Published: 2021-08-02 14:38:03

| [Menu](https://dev.to/priscilla_parodi/a-guide-to-machine-learning-ai-with-the-elastic-stack-1dkl) | [Next Post: Elastic Data Frame - Classification vs Regression](https://dev.to/priscilla_parodi/elastic-data-frame-classification-vs-regression-4cod) |

> Unlike the [Anomaly Detection](https://dev.to/priscilla_parodi/elastic-anomaly-detection-learning-process-and-anomaly-score-3nl7) models, this is a multi-variate analysis, it enables a better understanding of complex behaviors that are described by many features. For this analysis we have 3 models with different algorithms and learning types ([Outlier](https://dev.to/priscilla_parodi/elastic-data-frame-outlier-detection-16ni), [Regression](https://dev.to/priscilla_parodi/elastic-data-frame-regression-analysis-2ge2) and Classification) and in this post we'll talk about Classification Analysis.

**Classification** predicts the class or category of a given data point in a data set (Supervised ML).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z97o8dgzzombkqd47a5v.png)

In regression the goal is to have our prediction close to the actual value. In classification the goal is to be correct (and heavily penalize incorrect predictions).

###Evaluation of the Classification analysis###

The algorithms we are using for Classification are Boosted Tree and Logistic Function.

A Logistic function can be fit to the data using a cross-entropy cost function, which essentially computes a measure of dissimilarity between the true (observed) probabilities and our model of the probabilities. The goal is to make the model output be as close as possible to the desired output (true classes).

Kibana provides a normalized confusion matrix that contains the percentage of occurrences where the analysis classified data points correctly with their actual class, for example, `TP` and `TN` in the image below are good results when they have a higher percentage than `FN` and `FP` because this means that the prediction of "true and false" was correct, corresponding to the real value, in most cases. The higher the percentage in this case, the better.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3towpzlxgr6dlifb66pw.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72458nfcs0hnjocgyhbn.png)

Kibana also provides the receiver operating characteristic (ROC) curve as part of the model evaluation. The plot compares the true positive rate (y-axis) to the false positive rate (x-axis) for each class; in this example, true and false. It is a number between 0 and 1. The higher the AUC, the better the model is at predicting the classes correctly.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qspaajwehfio6rkay8pu.png)

| [Menu](https://dev.to/priscilla_parodi/a-guide-to-machine-learning-ai-with-the-elastic-stack-1dkl) | [Next Post: Elastic Data Frame - Classification vs Regression](https://dev.to/priscilla_parodi/elastic-data-frame-classification-vs-regression-4cod) |

>*This post is part of a series that covers [Artificial Intelligence with a focus on Elastic's (Creators of Elasticsearch) Machine Learning solution](https://dev.to/priscilla_parodi/a-guide-to-machine-learning-ai-with-the-elastic-stack-1dkl), aiming to introduce and exemplify the possibilities and options available, in addition to addressing the context and usability.*