# Accuracy Formula in Machine Learning

A significant assessment parameter for classification model performance in machine learning is accuracy. It displays the percentage of the model's total forecasts that were accurate predictions.

The accuracy formula is quite straightforward and is expressed as:

Accuracy = (Number of Correct Predictions) / (Total Number of Predictions)

The formula may be expressed mathematically as follows: Let's represent the number of accurate forecasts as TP (True Positives) and the number of inaccurate predictions as TN (True Negatives).

Accuracy = (TP + TN) / (TP + TN + FP + FN), here

The proportion of events that are accurately classified as positive is known as TP.

The number of instances that are accurately classified as negative is referred to as TN.

False positives, or FPs, are occasions where the outcome is wrongly forecasted as positive.

False negatives, or FN, are occasions where the outcome is wrongly projected to be negative.

It is important to note that accuracy is a meaningful statistic when the classes are balanced, which means that there are roughly equal numbers of instances in each class. However, accuracy might not give a true picture of the model's performance in circumstances of unbalanced datasets, when one class predominates over the other.

Other assessment measures, such as precision, recall, F1 score, or area under the ROC curve (AUC-ROC), maybe more suitable in certain circumstances.

## Accuracy Importance

Model accuracy is a crucial parameter since it is a very straightforward measure of model performance, as was previously said. It is also a straightforward metric of model error, which we haven't covered yet. Accuracy can really be thought of as (1 - error).

Accuracy is a highly efficient and useful indicator to assess machine learning prediction accuracy in both of its forms. It is one of the measures that is most frequently employed in research, where it is typical to have clean and balanced datasets to allow for attention to improvements in the algorithmic approach.

When datasets with comparable qualities are available, accuracy can be valuable for real-world applications as well. This ease of reporting on the value of the model to all stakeholders increases the likelihood that an ML program will be successful since it makes it simple to connect model accuracy with a number of business KPIs, such as revenue and cost.

## Accuracy Model Matrices Machine Learning

In machine learning, a classification model's accuracy is measured using a variety of frequently used metrics. Some of the most significant assessment measures are listed below:

Accuracy: In order to determine how precise the predictions made by the model are overall, the statistic called accuracy is frequently utilized.  It is computed as the proportion of accurate forecasts to all predictions combined.

Accuracy = (TP + TN) / (TP + TN + FP + FN)

In this situation, the total number of instances that were correctly anticipated as positive is marked by TP, whereas the total number of instances that were predicted as negative is denoted by TN. False Positive (FP) is referred to all cases that were incorrectly anticipated as positive, while False Negative (FN) is referred to all cases that were incorrectly shown as negative.

Precision is the percentage of positively predicted instances out of all positively anticipated cases. It gauges how well the model can steer clear of false positives.

Precision = TP / (TP + FP)

The proportion of accurately anticipated positive cases out of all actual positive instances is known as recall (also known as sensitivity or true positive rate). It gauges how well the model can identify instances of success.

Recall = TP / (TP + FN)

F1 Score: The harmonic mean of recall and accuracy is the F1 score. It offers a balanced measurement that takes into account both recall and accuracy.

F1 Score = 2 * (Precision * Recall) / (Precision + Recall)

Specificity: The percentage of accurately anticipated negative events among all actual negative events is known as specificity. It gauges how well the model can steer clear of false negatives.

Specificity = TN / (TN + FP)

These measurements shed light on various facets of the model's functionality. Different measures may be more suited to assess the model's accuracy depending on the issue and the class distribution. To fully comprehend the performance of the model, it is crucial to take into account a variety of measures.