appears with feature in certain range (called bineach plot overlays two histogramsone for all of the points in the benign class (blueand one for all the points in the malignant class (redthis gives us some idea of how each feature is distributed across the two classesand allows us to venture guess as to which features are better at distinguishing malignant and benign samples for examplethe feature "smoothness errorseems quite uninformativebecause the two histograms mostly overlapwhile the feature "worst concave pointsseems quite informativebecause the histograms are quite disjoint howeverthis plot doesn' show us anything about the interactions between variables and how these relate to the classes using pcawe can capture the main interactions and get slightly more complete picture we can find the first two principal componentsand visualize the data in this new two-dimensional space with single scatter plot before we apply pcawe scale our data so that each feature has unit variance using standardscalerin[ ]from sklearn datasets import load_breast_cancer cancer load_breast_cancer(scaler standardscaler(scaler fit(cancer datax_scaled scaler transform(cancer datalearning the pca transformation and applying it is as simple as applying preprocessing transformation we instantiate the pca objectfind the principal components by calling the fit methodand then apply the rotation and dimensionality reduction by calling transform by defaultpca only rotates (and shiftsthe databut keeps all principal components to reduce the dimensionality of the datawe need to specify how many components we want to keep when creating the pca objectin[ ]from sklearn decomposition import pca keep the first two principal components of the data pca pca(n_components= fit pca model to breast cancer data pca fit(x_scaledtransform data onto the first two principal components x_pca pca transform(x_scaledprint("original shape{}format(str(x_scaled shape))print("reduced shape{}format(str(x_pca shape)) unsupervised learning and preprocessing