1/20
Looks like no tags are added yet.
Topic 1 — Pandas Fundamentals | Introducing Pandas Objects | What is printed? Code: import pandas as pd; s = pd.Series([5, 10, 15], index=['x', 'y', 'z']); print(s['y'] + s['x']) | A. 10 | B. 5 | C. 15 | D. 25
C. 15 — Find the labels first: y = 10 and x = 5. Then add 10 + 5 = 15. Labels determine which values are selected.
Topic 1 — Pandas Fundamentals | Operations in Pandas: Index Alignment | What value is printed? Code: A = pd.Series([4, 6, 8], index=['a', 'b', 'c']); B = pd.Series([1, 3, 5], index=['b', 'c', 'd']); print((A + B)['c']) | A. 13 | B. 11 | C. 9 | D. NaN
B. 11 — Match index labels, NOT positions. At c: A[c] = 8 and B[c] = 3, so 8 + 3 = 11. The unmatched labels a and d give NaN but c does not.
B. 2 — At index c, A has no value but B[c] = 2. The fill_value=0 treats the missing entry as zero: 0 + 2 = 2.
B. 6.0 — Group A contains Value entries 2, 6, 10. Sum = 18. There are 3 A rows. Mean = 18 / 3 = 6.0. Do not average all five rows.
B. On the second subplot only — Python uses zero-based indexes: ax[0] is the first Axes, ax[1] the second. The plot call targets ax[1].
C. The horizontal axis runs from 4 down to 0 — xlim controls x (horizontal) display limits. Reversing the limits reverses the axis direction. The original data stays unchanged.
C. (2,5) — The size array s matches the points in order: (1,4)→10, (2,5)→100, (3,6)→30. 100 is the largest. c sets color; alpha sets transparency.
D. (4,4) — A 2D histogram divides the x-axis into 4 bins and y-axis into 4 bins. The grid has 4 × 4 = 16 cells, arranged in a 2D array of shape (4,4).
D. 1/2 — First narrow the possible outcomes to multiples of 3: {3,6,9,12}. Then count the even ones: {6,12}. That's 2 successes out of 4 eligible outcomes = 2/4 = 1/2. Do not divide by all 12.
C. 66.7% — Imagine 100 people: 20 have condition, and 80% of 20 = 16 test positive. Of 80 without condition, 10% of 80 = 8 test positive. Total positives = 16 + 8 = 24. Of the 24 positives, 16 truly have it: 16/24 = 2/3 ≈ 66.7%.
C. 88.9% — Chebyshev: at least 1 − 1/k² within k standard deviations (k>1). Set k=3: 1 − 1/9 = 8/9 ≈ 88.9%. Don't confuse it with the normal distribution's 99.7% empirical rule.
A. Unsupervised learning — The algorithm discovers patterns or groups without known output labels. Supervised learning would require labeled examples.
A. Classification — 0 and 1 are codes for categories (sunny/rainy). Numeric coding does not turn a categorical target into continuous regression.
D. 75% — Step 1: 25% = 1/4, so test set size = 160 ÷ 4 = 40. Step 2: 30 of 40 predictions correct. Step 3: accuracy = 30/40 = 3/4 = 75%. Denominator is the TEST set, not all 160.
D. Point C — Compare squared distances to avoid square roots: A=(4−1)²+(6−2)²=9+16=25; B=(1−1)²+(6−2)²=0+16=16; C=(4−1)²+(2−2)²=9+0=9. Smallest is C, distance 3.
B. Blue → Red — K=3: Red 1, Blue 2, so Blue wins. K=5: Red 3, Blue 2, so Red wins. Write two tally columns rather than track the counts mentally.
D. Less sensitive to an individual noisy point, but potentially biased toward common classes — A larger K votes across more observations; it does not guarantee better accuracy.
A. 20, once — Fold size = 120 ÷ 6 = 20. Each fold is testing once; the other 100 observations train the model in that round. Every observation tests once and trains five times.
D. Model-driven bias and fairness — Good overall accuracy can hide much worse performance for a subgroup. The lecture emphasizes difficulties with minority classes and unequal model errors.
B. Integrity in communications and modeling — Showing only the best result is cherry-picking and conceals how variable the model's performance is across splits.