Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Write Program Python Determine Number Principal Components Needed Account Least 90 Origina Q35534680

Write a program in python that will determine the number ofprincipal components needed to account for at least 90% of theoriginal variance using the SVD method. Test your code on thefollowing:

#Example 1

import numpy as np

X_1 = np.array([[ 2.3274536 , 33.25695914, 14.96878067],
[ 4.19453082, 35.06359 , 13.97859516],
[ 4.31177923, 35.16899706, 13.30989608],
[ 3.96107037, 34.10774362, 12.21730125],
[ 3.62347256, 34.70090141, 14.99825952],
[ 4.68249902, 35.57413983, 16.27156219],
[ 5.06590762, 36.38886197, 16.65805796],
[ 3.69650025, 35.10287756, 15.39076382],
[ 4.17222781, 34.28040143, 12.55486321],
[ 4.896751 , 36.43614788, 15.42118771],
[ 4.12733412, 34.83318295, 15.10379113],
[ 2.72030528, 34.30122894, 14.33949962],
[ 3.2668926 , 35.66556434, 16.99643411],
[ 5.35912895, 35.62103351, 15.35045865],
[ 3.60775509, 35.13068934, 17.09406045],
[ 5.63857105, 36.22304214, 15.00777169],
[ 4.85668055, 35.13222782, 14.09112994],
[ 4.07657269, 35.66611846, 16.41514086],
[ 5.19064825, 36.10240812, 14.7315029 ],
[ 2.99810341, 34.68888137, 14.61828275],
[ 3.9700405 , 35.13776249, 17.18936714],
[ 5.43959364, 36.1510535 , 15.04825839],
[ 3.56200366, 33.69767735, 12.75919977],
[ 4.69479145, 34.76497034, 14.46303711],
[ 3.17472779, 33.85094963, 13.93077207],
[ 4.08642363, 34.43058526, 14.88477972],
[ 5.64249422, 36.66535534, 14.73679149],
[ 5.18711812, 36.30121021, 15.96608836],
[ 4.12708521, 35.20619939, 15.13208842],
[ 3.88415601, 35.0570352 , 15.02313139],
[ 4.5991572 , 35.74467073, 15.87194093],
[ 5.78186705, 36.34515282, 15.70672737],
[ 3.78412159, 34.51592352, 15.32963919],
[ 3.60606307, 34.02990205, 14.07168597],
[ 3.2739402 , 33.71801987, 13.41270013],
[ 5.16119866, 36.38528368, 14.7278814 ],
[ 6.75485548, 37.68874609, 15.91717489],
[ 2.95378926, 34.307244 , 15.28935653],
[ 4.49452346, 35.12343348, 15.86594283],
[ 3.82233399, 34.09661095, 13.52317582],
[ 3.31711371, 34.16023552, 13.93975829],
[ 1.95873191, 33.65323899, 13.44433234],
[ 1.85031391, 32.66730796, 12.23398107],
[ 3.22207743, 34.63205976, 15.10883978],
[ 4.73242483, 36.66993015, 17.03251396],
[ 2.23253617, 33.68055586, 15.06587145],
[ 3.00168024, 33.91891594, 14.79353672],
[ 6.0805478 , 37.34162738, 16.43396113],
[ 3.78114773, 34.66495606, 16.67256649],
[ 5.62711975, 36.42372661, 16.97573921]])

T_1 = np.array([[ 2.09623284, 1.46996309],
[ 0.58331 , -0.82838595],
[ 0.84969751, -1.44457302],
[ 2.32422754, -1.82746189],
[ 0.50929535, 0.38615634],
[-1.33532582, 0.55497699],
[-2.26242254, 0.43051267],
[-0.00474183, 0.54856406],
[ 1.90813002, -1.72804427],
[-1.4738348 , -0.45170017],
[ 0.09785675, 0.14792919],
[ 1.6216297 , 0.48778325],
[-1.0612068 , 1.90402778],
[-1.18365288, -0.5619817 ],
[-0.97544976, 1.92288364],
[-1.49734049, -1.14266088],
[ 0.12193357, -1.13500709],
[-1.15213678, 0.98866775],
[-1.02248861, -1.07266799],
[ 1.07382053, 0.44840043],
[-1.22918644, 1.78926729],
[-1.37115029, -0.97933971],
[ 2.46801462, -1.07205309],
[ 0.21299456, -0.65840513],
[ 1.89296847, 0.02471997],
[ 0.49314748, 0.1029545 ],
[-1.60901275, -1.4696352 ],
[-1.86712248, -0.15678865],
[-0.14537904, 0.07487973],
[ 0.13902846, 0.16617373],
[-1.1595938 , 0.24661163],
[-2.05890726, -0.7093098 ],
[ 0.34118385, 0.60087394],
[ 1.47108418, -0.15648951],
[ 2.22531939, -0.40261055],
[-1.17658157, -1.13100131],
[-3.5187604 , -1.44214849],
[ 0.93500398, 1.09548947],
[-0.72259102, 0.46022082],
[ 1.63748206, -0.72525982],
[ 1.6236719 , -0.12834959],
[ 2.94826624, 0.38751138],
[ 4.31687391, -0.24458811],
[ 0.70043909, 0.71869494],
[-2.47533013, 0.84116819],
[ 1.83235759, 1.49164618],
[ 1.4369171 , 0.78001893],
[-3.25152922, -0.56572692],
[-0.53717721, 1.61380659],
[-2.76996479, 0.35028633]])

Leave a Reply

Your email address will not be published. Required fields are marked *