Several items were measured for multiple people. How should these values be organized to make the required computations and comparisons easier?
Description
Giving value positions consistent meanings, such as placing the same item in the same column, makes selection, computation, and comparison easier.
Define what rows and columns mean, as well as the array size.
02 Ways to examine data
What representation would help reveal changes or differences in many measurements more effectively than reading numbers alone?
Description
Table: inspect specific values / Plot: compare trends and changes
Include axis names, units, and legends needed to interpret plots
Practice
1. Array shapes
Create a NumPy Array from and print its shape, dtype, mean, values at least 80, and their count.
Arrange 1~20 into (4,5), then print the first row, last column, middle 2-row×3-column region, and even values separately.
2. Operations and verification
For and , compute the Element-wise Product and Matrix Multiplication and explain how element (0,1) is obtained.
Compute A's Determinant and Inverse and use np.allclose to verify that A@Inverse is the Identity.
Change A[0,0] to 4 and repeat.
3. Plot the results
Create x with 100 samples from 0~2π and plot sin and cos together.
Then use , , and to display sin, cos, Loss, and Accuracy in a 2×2 Figure.
Label axes and add a Legend, locate the maximum Accuracy in code, and mark it with an annotation.
Submission and saving
Include code, actual outputs and plots, and your own interpretation. Submit through KLAS; check the semester schedule and latest announcements for the deadline.
Filename: Name_StudentID_Week3.ipynb.
Restart the runtime, run all code from the top, then save.
Optional practice
reshape with an incompatible element count
After importing NumPy, add a Code Cell at the bottom of the notebook and run the following code.
debug_values = np.arange(12)
for debug_shape in [(5, 3), (3, 4)]:
print("requested shape:", debug_shape, "elements:", debug_values.size)
try:
print(debug_values.reshape(debug_shape))
except ValueError as error:
print(type(error).__name__, str(error))
In a Text Cell, tabulate the required element count and execution success for each requested shape. Also explain in one sentence the order in which values from 0 to 11 are arranged in the successful array.