Question: The transformed vectors will have a zero mean and zero correlation. Since the pdf is Gaussian, these variables will be independent. Pseudo code: #
The transformed vectors will have a zero mean and zero correlation. Since the pdf is Gaussian, these variables will be independent. Pseudo code: # Stacking features to a matrix Data = np.matrix([x1.y1]) # 1. Compute the mean and covariance matrix # 2. Perform eigendecomposition of covariance matrix #3. Modify the code below to get uncorrelated and rotated features xnew # rprime = xnew = np.transpose(rprime[0.:]) ynew = np.transpose(rprime[1.:]) #- # Plotting fig4 = plt.figure() ax4 = fig4.add_subplot(1, 1, 1) plt.plot(xnew, ynew, 'x') plt.xlim([-6,6]) plt.ylim([-6,6]) Xnew = : UT (x ) ax4.set_title('Transformed Samples') ax4.set_aspect('equal') mu_rotated = np.array((np.matrix.mean(rprime,axis=0))) Sigma_rotated = np.cov(Data) 2. Feature Normalization/Whitening To do #2: Feature Normalization/Whitening Most machine learning algorithms work well when the input features are "normalized" (e.g independent and are zero mean). We will now look at a data whitening transformation, which will take the original features and spit out normalized feaures. Find the expression for the matrix A and vector b such that the transformed features Xnew = A(x-) are uncorrelated and indentically distributed with zero mean as in Figure 1. The A matrix can be obtained from the eigen decomposition of the covariance matrix = UAUT as A = A-1/2 UT Pseudo Code: Data = np.matrix([x1.y1]) # Transformation # Modify the code below to get uncorrelated and uniformly distributed features -# rprime = xnew = np.transpose(rprime[0,:]) ynew = np.transpose(rprime[1,:]) #- fig4 = plt.figure( ax4 = fig4.add_subplot(1, 1, 1) plt.plot(xnew, ynew, 'x') plt.xlim([-6,6]) plt.ylim([-6,6]) ax4.set_title('Transformed Samples') ax4.set_aspect('equal')
Step by Step Solution
There are 3 Steps involved in it
To perform data whitening which is a common preprocessing step in machine learning to ensure that th... View full answer
Get step-by-step solutions from verified subject matter experts
