Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The code cells below perform the following tasks: Create matrices A 0 , dots, A 9 each of size 5 3 which represent the digits
The code cells below perform the following tasks: Create matrices dots, each of size which represent the digits to Visualize the matrices as pixel images Flatten each matrix into a vector of length and construct a matrix A with vectors dots, in the columns: Use the matrix to answer the problems ae below. array array array array array array array array A nparray Flatten each matrix into a vector of length and put the vectors into the columns of a matrix : npcolumnstackdigitflatten for digit in digits A Let be the th column of Remember that indices start at in Python. The vector reshaped into a matrix is exactly For example, the column at index in A reshaped into a matrix is displayed below. Problem c marks The digit looks like a combination of and Compute the orthogonal projection of onto span Save the result as proj Note that you can select columns and from matrix A and save to variable with the command: : and compute the thin QR decomposition using the function scipy. linalg. qr with the parameter mode'economic': QR laqrAmode'economic' Recall the projection of a vector onto for some matrix is where # # Test : Verify type and size of proj mark assert isinstanceprojnpndarray assert projsize printTest : Success!"pltshow Problem d marks Find the shortest distance from to span Save the result as distance Use the function scipy. linalg. norm to compute the norm. # YOUR CODE HERE # Test : Verify distance is a positive number close to mark assert distance assert nprounddistance
The code cells below perform the following tasks:
Create matrices dots, each of size which represent the digits to
Visualize the matrices as pixel images
Flatten each matrix into a vector of length and construct a matrix A with
vectors dots, in the columns:
Use the matrix to answer the problems ae below.
array
array
array
array
array
array
array
array
A nparray Flatten each matrix into a vector of length and put the vectors into the columns of a matrix :
npcolumnstackdigitflatten for digit in digits
A
Let be the th column of Remember that indices start at in Python. The vector
reshaped into a matrix is exactly For example, the column at index in A reshaped
into a matrix is displayed below. Problem c marks
The digit looks like a combination of and Compute the orthogonal projection of onto
span Save the result as proj
Note that you can select columns and from matrix A and save to variable
with the
command:
:
and compute the thin QR decomposition using the function scipy. linalg. qr with the
parameter mode'economic':
QR laqrAmode'economic'
Recall the projection of a vector onto for some matrix is where
#
# Test : Verify type and size of proj mark
assert isinstanceprojnpndarray
assert projsize
printTest : Success!"pltshow
Problem d marks
Find the shortest distance from to span Save the result as
distance Use the function scipy. linalg. norm to compute the norm.
# YOUR CODE HERE
# Test : Verify distance is a positive number close to mark
assert distance
assert nprounddistance
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started