# How would normalizing be affected by outliers? And how to avoid it?

I have a data set that boils down to Three clomuns: 1.Supplier name 2. Number of transactions with supplier 3. Total value of those transaction.

I'm trying to find the best way to rank all suppliers based on these two features which are equally important in this case. Note: -more transaction doesn't mean more value

What I did is I normalized each feature. Making all values scale down to 0 to 1. Then I added the 2 normalized values to each other. Then used this new values to rank all suppliers. Looking at the results and what I expected a good ranking to be, I'm happy with the result.

However, I feel like the existing of outliers might've made the ranking.. not as accurate as it can be. Am I right or wrong? How would you suggest fixing this? Is there an entierly better way to do this?

Final note: I tried standarizing and got the exact same ranking. I'm not sure if that was supposed to happen or if it was a special case.

You asked how min/max normalization would affect your ranking in the presence of outliers. Your ranking metric is a simple sum of the normalized values. An outlier will change the scale of your normalized values and hence its importance in your ranking metric. Some alternatives to your proposed metric are common in literature for multi-objective optimization. Here is a paper that reviews several methods for selecting the "best" point from a Pareto front. In case the link dies the paper is called Application and Analysis of Methods for Selecting an Optimal Solution from the Pareto-Optimal Front obtained by Multiobjective Optimization by Zhiyuan Wang and Gade Pandu Rangaiah.

Below is an example in R using your proposed ranking metric.

# number of supplies considered
n = 10

set.seed(123)
# create data frame containing supplier ID, randomly draw number of
# transactions from a poisson distribution and initalize total sales to zero
df <- data.frame(supplierID = 1:n,
transactions = rpois(n, 20),
total = rep(0,n))

# add data for total sales, draw each sale from a gamma distribution
for(i in 1:n){
df$$total[i] <- sum(rgamma(n=df$$transactions[i], shape = 3, scale = 100))
}

# function for min/max normalization
min_max_norm <- function(x){
min_x <- min(x)
max_x <- max(x)
return( (x-min_x)/(max_x - min_x) )
}

# generate normalized data and ranking metric
df$$norm_transactions <- min_max_norm(df$$transactions)
df$$norm_total <- min_max_norm(df$$total)
df$$rank_metric <- df$$norm_transactions + df$$norm_total df$$rank <- rank(df$rank_metric) # duplicate this data and add outliers to the transactions data df$$transactions_OL <- df$$transactions # Set transactions of supplier with least transactions to 2 df$$transactions_OL[which.max(df$$transactions)] <-2 # Set transactions of supplier with most transactions to 600 df$$transactions_OL[which.max(df$$transactions)] <- 600 # normalize the transaction data with outliers, update rank metric and rank df$$norm_transactions_OL <- min_max_norm(df$$transactions_OL) df$$rank_metric_OL <- df$$norm_transactions_OL + df$$norm_total df$$rank_OL <- rank(df$rank_metric_OL)

# print data frame to console
df


So, what happened when we added the outlier? The range of transactions (and hence scale) changed, which lowered the importance of transaction relative to the total sale value. A good illustration of this is supplier 2 dropping from 3rd to 5th place and supplier 10 jumping from 5th to 3rd place.