# Why would we want to normalize (L1) by row?

I've read this question which seems similar but answers didn't address when we would want to normalize by sample (row): Should I normalize featurewise or samplewise

I ask specifically about normalization by the L1 norm for simplicity but also applies to L2 normalization.

In both scikit-learn and pyspark the default is to normalize across sample (row) rather than across feature. This surprised me since I find it hard to think of an occasion where we would want to normalize our features over the rows of the data rather than the feature column. Can anyone give an example of where this would be useful?

In case the row-wise and column-wise distinction is not clear:

      x    y       x_row_norm      x_column_norm
1     1    10      0.0909          0.167
2     2    20      0.0909          0.333
3     3    30      0.0909          0.5


where the l1 norm is sum(|x|), normalizing across the row is given by 1/(1+10) = 0.0909 while normalizing by feature (column) is 1/(1+2+3) = 1.167

## 1 Answer

One situation that might call for normalization by rows is when all of the features are of essentially the same type but their values can systematically differ among samples. For example, in RNA sequencing the absolute amount of RNA might differ from sample to sample, resulting in systematically different values among samples (rows) for the observed values of each of the 20,000 or so genes (columns) whose expression is being evaluated. In that type of case it might make sense to take those systematic differences among samples into account via normalizing by row. If the features are fundamentally different in type, however, your sense is correct.

• Thanks for the response. The possibility of systematic biases between samples is something I hadn't considered! – Chris Jan 17 '20 at 23:18