How to check Model performance

No alt text provided for this image


Confusion Matrix

A confusion matrix is an N X N matrix, where N is the number of classes being predicted. For the problem in hand, we have N=2, and hence we get a 2 X 2 matrix. Here are a few definitions, you need to remember for a confusion matrix.


  • Accuracy : the proportion of the total number of predictions that were correct.
  • Positive Predictive Value or Precision : the proportion of positive cases that were correctly identified.
  • Negative Predictive Value : the proportion of negative cases that were correctly identified.
  • Sensitivity or Recall : the proportion of actual positive cases which are correctly identified.
  • Specificity : the proportion of actual negative cases which are correctly identified.
No alt text provided for this image

F1 Score

What if for a use case, we are trying to get the best precision and recall at the same time? F1-Score is the harmonic mean of precision and recall values for a classification problem. The formula for F1-Score is as follows:


No alt text provided for this image

Gain and Lift charts

Gain and Lift chart are mainly concerned to check the rank ordering of the probabilities. Here are the steps to build a Lift/Gain chart:

Step 1 : Calculate probability for each observation

Step 2 : Rank these probabilities in decreasing order.

Step 3 : Build deciles with each group having almost 10% of the observations.

Step 4 : Calculate the response rate at each deciles for Good (Responders) ,Bad (Non-responders) and total.

Kolomogorov Smirnov chart

K-S or Kolmogorov-Smirnov chart measures performance of classification models. More accurately, K-S is a measure of the degree of separation between the positive and negative distributions. The K-S is 100, if the scores partition the population into two separate groups in which one group contains all the positives and the other all the negatives.

On the other hand, If the model cannot differentiate between positives and negatives, then it is as if the model selects cases randomly from the population. The K-S would be 0. In most classification models the K-S will fall between 0 and 100, and that the higher the value the better the model is at separating the positive from negative cases.

Area Under the ROC curve (AUC – ROC)

This is again one of the popular metrics used in the industry. The biggest advantage of using ROC curve is that it is independent of the change in proportion of responders.

No alt text provided for this image
No alt text provided for this image

The ROC curve is the plot between sensitivity and (1- specificity). (1- specificity) is also known as false positive rate and sensitivity is also known as True Positive rate. Following is the ROC curve for the case in hand.

No alt text provided for this image

Things needs to remember in ROC

1. For a model which gives class as output, will be represented as a single point in ROC plot.

2. Such models cannot be compared with each other as the judgement needs to be taken on a single metric and not using multiple metrics. For instance, model with parameters (0.2,0.8) and model with parameter (0.8,0.2) can be coming out of the same model, hence these metrics should not be directly compared.

3. In case of probabilistic model, we were fortunate enough to get a single number which was AUC-ROC. But still, we need to look at the entire curve to make conclusive decisions. It is also possible that one model performs better in some region and other performs better in other.

Log Loss

AUC ROC considers the predicted probabilities for determining our model’s performance. However, there is an issue with AUC ROC, it only takes into account the order of probabilities and hence it does not take into account the model’s capability to predict higher probability for samples more likely to be positive. In that case, we could us the log loss which is nothing but negative average of the log of corrected predicted probabilities for each instance.

Gini Coefficient

Gini coefficient is sometimes used in classification problems. Gini coefficient can be straigh away derived from the AUC ROC number. Gini is nothing but ratio between area between the ROC curve and the diagnol line & the area of the above triangle. 

Root Mean Squared Error (RMSE

RMSE is the most popular evaluation metric used in regression problems. It follows an assumption that error are unbiased and follow a normal distribution. Here are the key points to consider on RMSE:

  1. The power of ‘square root’ empowers this metric to show large number deviations.
  2. The ‘squared’ nature of this metric helps to deliver more robust results which prevents cancelling the positive and negative error values. In other words, this metric aptly displays the plausible magnitude of error term.
  3. It avoids the use of absolute error values which is highly undesirable in mathematical calculations.
  4. When we have more samples, reconstructing the error distribution using RMSE is considered to be more reliable.
  5. RMSE is highly affected by outlier values. Hence, make sure you’ve removed outliers from your data set prior to using this metric.
  6. As compared to mean absolute error, RMSE gives higher weightage and punishes large errors.



要查看或添加评论,请登录

Indrajit S.的更多文章

  • Common XGBoost Mistakes to Avoid

    Common XGBoost Mistakes to Avoid

    Using Default Hyperparameters - Why Wrong: Different datasets need different settings - Fix: Always tune learning_rate,…

  • Processing Large Multiline Files in Spark: Strategies and Best Practices

    Processing Large Multiline Files in Spark: Strategies and Best Practices

    Handling large, multiline files can be a tricky yet essential task when working with different types of data from…

  • Integrating a Hugging Face Model with Google Colab

    Integrating a Hugging Face Model with Google Colab

    Integrating models from Hugging Face with Google Colab. Install Hugging Face Transformers Install required libs…

  • PyTorch GPU

    PyTorch GPU

    Check if CUDA is Available: This command returns True if PyTorch can access a CUDA-enabled GPU, otherwise False. Get…

  • How to choose the right model

    How to choose the right model

    Choosing the right model for a machine learning problem involves multiple steps, each of which can influence the…

  • ???? #DataScience Insight: The Significance of Data Cleaning ????

    ???? #DataScience Insight: The Significance of Data Cleaning ????

    In the world of Data Science, it's often said that 80% of a data scientist's valuable time is spent simply finding…

  • Machine Learning Model Monitoring

    Machine Learning Model Monitoring

    Machine Learning Model Monitoring ML monitoring verifies model behavior in the early phases of the MLOps lifecycle and…

  • How to optimise XGBOOST MODEL

    How to optimise XGBOOST MODEL

    How to optimise XGBOOST model XGBoost is a powerful tool for building and optimizing machine learning models, and there…

    1 条评论
  • why you should not give too much stress on this value in ML ?

    why you should not give too much stress on this value in ML ?

    What is seed Seed in machine learning means the initialization state of a pseudo-random number generator. If you use…

    1 条评论
  • Performance Tuning in join Spark 3.0

    Performance Tuning in join Spark 3.0

    When we perform join in spark and if your data is small in size .Then spark by default applies the broad cast join .

社区洞察

其他会员也浏览了