two-dimensional dataset to one-dimensional dataset notehoweverthat instead of keeping only one of the original featureswe found the most interesting direction (top left to bottom right in the first paneland kept this directionthe first principal component finallywe can undo the rotation and add the mean back to the data this will result in the data shown in the last panel in figure - these points are in the original feature spacebut we kept only the information contained in the first principal component this transformation is sometimes used to remove noise effects from the data or visualize what part of the information is retained using the principal components applying pca to the cancer dataset for visualization one of the most common applications of pca is visualizing high-dimensional datasets as we saw in it is hard to create scatter plots of data that has more than two features for the iris datasetwe were able to create pair plot (figure - in that gave us partial picture of the data by showing us all the possible combinations of two features but if we want to look at the breast cancer dataseteven using pair plot is tricky this dataset has featureswhich would result in scatter plotswe' never be able to look at all these plots in detaillet alone try to understand them there is an even simpler visualization we can usethough--computing histograms of each of the features for the two classesbenign and malignant cancer (figure - )in[ ]figaxes plt subplots( figsize=( )malignant cancer data[cancer target = benign cancer data[cancer target = ax axes ravel(for in range( )_bins np histogram(cancer data[: ]bins= ax[ihist(malignant[: ]bins=binscolor=mglearn cm ( )alpha ax[ihist(benign[: ]bins=binscolor=mglearn cm ( )alpha ax[iset_title(cancer feature_names[ ]ax[iset_yticks(()ax[ set_xlabel("feature magnitude"ax[ set_ylabel("frequency"ax[ legend(["malignant""benign"]loc="best"fig tight_layout( unsupervised learning and preprocessing