types of machine learning with the initial data preparation behind youyou can execute the pca the resulting scree plot (which will be explained shortlyis shown in figure because pca is an explorative techniquewe now arrive at step four of the data science processdata explorationas shown in the following listing listing executing the principal component analysis creates instance of principal component analysis class model pca(results model fit(xz results transform(xplt plot(results explained_variance_plt show(shows plot applies pca on predictor variables to see if they can be compacted into fewer variables turns result into array so we can use newly created data plots explained variance in variablesthis plot is scree plot now let' look at the scree plot in figure the plot generated from the wine data set is shown in figure what you hope to see is an elbow or hockey stick shape in the plot this indicates that few variables can represent the majority of the information in the data set while the rest only add little more in our plotpca tells us that reducing the set down to one variable can capture approximately of the total information in the set (the plot is zero-basedso variable figure pca scree plot showing the marginal amount of information of every new variable pca can create the first variables explain approximately of the variance in the datathe second variable accounts for another %the third approximately %and so on