Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
You're offline
Unit 14 MCQsMachine Learning Packages in Python
ECAP792 ·
60 questions. Pick an option to check it.
The Axes.set method can assign the title, x-axis label, and y-axis label to a specific subplot.
Question 27 of 60 · Simple line and scatter plots · Medium
A table contains measurements recorded at irregular times and stored in random row order. What should be done before drawing a line plot that represents temporal progression?
Not quite. Try another option.
Answer: Sort the observations by time
A line plot connects points in their supplied order, so sorting by time ensures a meaningful temporal path.
Question 28 of 60 · Simple line and scatter plots · Medium
In plt.scatter(x, y, c=score, cmap="viridis"), what does the score array control?
Not quite. Try another option.
Answer: The color assigned to each point
The c argument maps numerical values to point colors using the specified colormap.
Question 29 of 60 · Simple line and scatter plots · Medium
Two lines are plotted with label="Actual" and label="Predicted", but their labels do not appear on the chart. Which additional call is required?
Not quite. Try another option.
Answer: plt.legend()
plt.legend() displays the labels associated with the plotted lines.
Question 30 of 60 · Seaborn · Medium
A DataFrame contains height, weight, and a categorical column species. Which call creates a scatter plot whose point colors distinguish species?
keep_default_na=False disables pandas' built-in missing-value tokens, while na_values=["?"] explicitly marks only ? as missing.
Question 42 of 60 · Data import · Hard
What happens when pd.read_csv receives both dtype={"id": "Int64"} and a converters function for the id column?
Not quite. Try another option.
Answer: The converter takes precedence and determines the resulting values.
For a column with a converter, pandas uses the converter instead of the requested dtype; the converter must perform any required type conversion itself.
Question 43 of 60 · Data import · Hard
A large CSV is read with chunksize=10000. Early chunks contain only integers in column x, while later chunks include missing values. Which approach best guarantees a consistent nullable-integer schema after concatenation?
Not quite. Try another option.
Answer: Specify dtype={"x": "Int64"} when creating the chunk reader.
Question 44 of 60 · Visualization with Matplotlib · Hard
After creating several figures, code must add a line specifically to an earlier axes object ax1, regardless of pyplot's current figure. Which call is reliable?
Not quite. Try another option.
Answer: ax1.plot(x, y)
The object-oriented call targets ax1 directly and does not depend on pyplot's mutable current-axes state.
Question 45 of 60 · Visualization with Matplotlib · Hard
Two subplots are created with fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True). What is the expected effect of ax1.set_xlim(0, 10)?
Not quite. Try another option.
Answer: Both axes receive the new limits because their x-axes are shared.
Shared axes synchronize their corresponding view limits, so changing the x-limits through either axes updates both.
Question 46 of 60 · Visualization with Matplotlib · Hard
Two scatter plots use the same colormap, but their numeric ranges differ. Which design makes a given numeric value map to the same color in both plots?
Not quite. Try another option.
Answer: Pass one shared Normalize(vmin, vmax) instance to both plots.
A shared normalization maps both datasets through the same numeric interval before the common colormap is applied.
Question 47 of 60 · Simple line and scatter plots · Hard
Given x = [3, 1, 2] and y = [30, 10, 20], what does ax.plot(x, y) do by default?
Not quite. Try another option.
Answer: It connects points in the supplied order: 3, then 1, then 2.
Matplotlib preserves input order; sorting must be performed explicitly when the line should progress monotonically along the x-axis.
Question 48 of 60 · Simple line and scatter plots · Hard
A plotted y-array is [1.0, 2.0, np.nan, 4.0]. How does a standard Matplotlib line normally represent the NaN?
Not quite. Try another option.
Answer: It creates a visible break between the surrounding line segments.
Non-finite values interrupt a line path, producing a gap rather than automatic interpolation or direct connection.
Question 49 of 60 · Simple line and scatter plots · Hard
In ax.scatter(x, y, s=36), what does the value 36 represent?
Not quite. Try another option.
Answer: A marker area of 36 squared typographic points.
The scatter parameter s specifies marker area in points squared, not radius, diameter, or data coordinates.
Question 50 of 60 · Simple line and scatter plots · Hard
For exactly three points, why can ax.scatter(x, y, c=(1, 0, 0)) fail to express the intended uniform red color?
Not quite. Try another option.
Answer: The tuple can be interpreted as three scalar values for colormap mapping.
When its length matches the number of points, c may be treated as per-point scalar data. Use color=(1, 0, 0) or a one-row RGB array.
Question 51 of 60 · Seaborn · Hard
A DataFrame has multiple score observations for each time. With no additional arguments, what does sns.lineplot(data=df, x="time", y="score") generally display?
Not quite. Try another option.
Answer: The mean score at each time with an uncertainty interval.
lineplot aggregates repeated y-values using the mean by default and normally displays a bootstrapped uncertainty interval.
Question 52 of 60 · Seaborn · Hard
Why is passing an existing Matplotlib axes through ax=ax generally inappropriate for sns.displot(...)?
Not quite. Try another option.
Answer: displot is figure-level and creates its own FacetGrid.
displot manages its own figure through a FacetGrid; an axes-level function such as histplot should be used to target an existing axes.
Question 53 of 60 · Seaborn · Hard
Separate filtered plots contain different subsets of category levels. Which approach most reliably keeps each hue category mapped to the same color across all plots?
Not quite. Try another option.
Answer: Use a category-to-color palette dictionary and a fixed hue_order.
Explicit category colors and ordering prevent subset-dependent level discovery from changing semantic color assignments.
Question 54 of 60 · Heatmap · Hard
A labeled DataFrame is plotted with sns.heatmap(data, annot=annotations), where annotations is a same-shaped NumPy array. How are annotation entries matched to cells?
Not quite. Try another option.
Answer: By positional array indices, independent of DataFrame labels.
Array-like annotations are placed by position. Seaborn does not perform label-based alignment for a plain NumPy annotation array.
Question 55 of 60 · Heatmap · Hard
When vmin and vmax are omitted, what is the main effect of robust=True in sns.heatmap?
Not quite. Try another option.
Answer: It derives color limits from robust quantiles instead of extreme values.
Robust mode chooses colormap limits from robust quantiles, reducing the visual compression caused by extreme observations without modifying the data.
Question 56 of 60 · Heatmap · Hard
A correlation heatmap is computed from columns with different missing-value patterns using pairwise-complete observations. Which subtle issue can arise?
Not quite. Try another option.
Answer: The displayed correlation matrix may fail to be positive semidefinite.
Different column pairs may use different row subsets, so the resulting pairwise correlations need not form a globally valid positive-semidefinite correlation matrix.
Question 57 of 60 · Introducing Scikit-learn package · Hard
A model uses imputation, standardization, and classification with cross-validation. Which structure best prevents validation-fold information from influencing preprocessing?
Not quite. Try another option.
Answer: Place preprocessing and classification inside one Pipeline.
Cross-validating a Pipeline refits every preprocessing step using only each training fold, preventing leakage from validation data.
Question 58 of 60 · Introducing Scikit-learn package · Hard
A ColumnTransformer combines sparse and dense transformer outputs with sparse_threshold=0.3. If the combined output density is , what output is expected?
Not quite. Try another option.
Answer: A sparse matrix because the combined density is below the threshold.
ColumnTransformer evaluates the density of the stacked result; when that density is below sparse_threshold, it returns a sparse matrix.
Question 59 of 60 · Introducing Scikit-learn package · Hard
Why does StandardScaler(with_mean=True) normally reject a SciPy sparse feature matrix?
Not quite. Try another option.
Answer: Centering would generally destroy sparsity and require dense storage.
Subtracting a nonzero feature mean turns implicit zeros into nonzero values, potentially densifying the matrix. Use with_mean=False for sparse input.
Question 60 of 60 · Introducing Scikit-learn package · Hard
A medical dataset has several rows per patient. Which cross-validation strategy prevents records from the same patient appearing in both training and validation sets?
Not quite. Try another option.
Answer: Use GroupKFold and supply patient identifiers as the groups.
GroupKFold keeps every sample belonging to a patient group entirely within one fold, avoiding patient-level leakage.
That's unit 14
Answer a few questions and your score shows up here.
Nearly through. Did unit 14 of ECAP792 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 14 of ECAP792 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.