# Where can I find more materials on 'binning' after PCA?

I am supposed to write a literature review on a particular paper for my University and I am lost after reading the main paper I am supposed to read. The link to the paper is here. The paper is from CERN and deals with using machine learning techniques to speed up the ATLAS calorimeter simulation.

In this, to simulate particle shower at CERN, they use a double PCA technique. First the events are decorrelated using PCA, the first principle component is taken and each event is grouped into 10 binns of the first PC. I don't understand this part. Can someone please tell me what one is doing when you bin the data points using a principle component? I tried searching but I cannot seem to find any reference to this concept anywhere. Even a pointer to a paper/write-up explaining this binning(why and how) would be really great.

The energy deposits per layer are correlated with each other. If, for example a large amount of energy is lost in the first layers, less will be deposited in the layers behind. In order to decorrelate those energy deposits, a principal component analysis (PCA) is used. A PCA is a transformation of a set of variables into a set of orthogonal and uncorrelated, so-called principal components. The first component has the largest variance. In order to achieve a better decorrelation, the events are divided into bins of the first (and/or second) component. The bins have approximately the same number of events, and typically a number of bins between 5 and 10 is chosen. A second PCA transformation is applied to the energy deposits per layer for the events in each of those bins, and hence the components of that second transformation are now largely decorrelated.

This is the paragraph explaining the procedure. The section which is bold is where I am confused.

• Binning is a name for converting a continuous variable into a categorical one. – mdewey Dec 30 '17 at 15:14
• It sounds like they split all observations in 10 groups using deciles of the PC1 scores. This is standard meaning of "binning". You don't need any further references for that. – amoeba Dec 30 '17 at 18:26

Let's draw a picture with two variables. It will illustrate the general idea.

To achieve this, I generated a set of 500 data with expected correlation of $0.25$, computed the first principal component (PC), cut it into five equinumerous bins, and computed the first PC for each of the bins. The first PC (not shown directly) points along the major axis of the cloud of all points. The boundaries between bins are lines perpendicular to that direction. These are shown in white. They carve the plane into five regions, to which the points are assigned and colored by region. The first PC of the points within each bin is indicated with an arrow originating at the centroid of the bin's points. (The centroids are marked with black dots.)

The sense in which this "decorrelates" anything is unclear, because--as is apparent in the plot--the points within each bin may, if anything, be more correlated than the original points. This procedure does stratify the data according to their positions along the major axis of the point cloud, thereby removing most of the effect of variation along the major axis: perhaps that accomplishes something useful in the application.

The R code is written to enable variation of the simulation parameters: number of points, correlation coefficient, and number of bins. I offer it for use in further exploring this situation.

library(MASS)       # Generates multivariate Normal data
library(ggplot2)    # Plots nicely
library(data.table) # Computes on data frames well
#
# Specify the multivariate data distribution.
#
n <- 5e2     # Sample size
mu <- c(0,0) # Mean
rho <- 0.25  # Correlation coefficient
n.bins <- 5  # Number of bins
#
# Generate correlated variables.
#
X <- as.data.table(mvrnorm(n, mu, matrix(c(1,rho,rho,1), 2))) # Observations
#
# Compute the first PC.
#
P <- prcomp(X, rank.=1)
X$PC1 <- t(t(X) - P$center) %*% P$rotation # # Bin the first principal component. # n.bins <- min(n.bins, n) q <- quantile(X$PC1, seq(0, 1, length.out=n.bins+1))
q <- -Inf; q[n.bins+1] <- Inf
X$Bin <- cut(X$PC1, q)
#
# Create a data frame for plotting the bin boundaries.
#
beta <- P\$rotation
Q <- data.table(intercept=q[-c(1,n.bins+1)]/beta, slope=-beta/beta)
#
# Do PCA by bin.
#
f <- function(x, y, length=1.5) {
s <- sign(cor(x,y))
slope <- s * sd(y) / sd(x)
intercept <- mean(y) - mean(x) * slope
list(x=mean(x), y=mean(y), xend=mean(x)+length*s*sd(x), yend=mean(y)+length*sd(y))
}
#
# Create a data frame for plotting the bin PCs.
#
P <- X[, c(f(V1, V2)), by=Bin]
#
# Plot the data and the results.
#
g <- ggplot(X, aes(V1, V2, group=Bin, color=Bin)) +
geom_abline(aes(intercept=intercept, slope=slope), data=Q,
size=1, color="White", alpha=0.9) +
geom_segment(aes(x=x, y=y, xend=xend, yend=yend), data=P,
size=1.25, arrow = arrow(length = unit(0.02, "npc"))) +
geom_point(aes(x, y), data=P, shape=19, size=1.5, color="Black") +
geom_point(alpha=0.4) +
coord_fixed() +
ggtitle("Bins of the First PC",
"First PC of Each Bin Shown With Arrows") +
theme(panel.grid=element_blank())
print(g)

• Very nice visual. Inspired choice of white for the lines. – Matthew Drury Dec 30 '17 at 21:35