We have also printed shape of intial and final dataset.Īs an output we get: [[ 0. PCA will transform (reduce) data into a k number of dimensions (. Now We have passed the parameter n_components as 0.85 which is the percentage of feature in final dataset. Often, it can be thought as the number of columns (except the label column) in a dataset. Print("Reduced number of features:", X_pca.shape)įoe better understanding we are applying PCA again. Print("Original number of features:", X.shape) Pca = PCA(n_components=0.85, whiten=True) We have also printed shape of intial and final dataset. We have passed the parameter n_components as 0.85 which is the percentage of feature in final dataset. We are also using Principal Component Analysis(PCA) which will reduce the dimension of features by creating new features which have most of the varience of the original data. X = StandardScaler().fit_transform(digits.data) StandardScaler is used to remove the outliners and scale the data by making the mean of the data 0 and standard deviation as 1. Here we have used datasets to load the inbuilt digits dataset. We will understand the use of these later while using it in the in the code snipet.įor now just have a look on these imports. Here we have imported various modules like PCA, datasets and StandardScale from differnt libraries. From sklearn.preprocessing import StandardScaler
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |