Unit 6: Pipelines, Model Evaluation and Model Deployment - Practice Quiz

INT395 — Supervised Learning 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 What is the primary purpose of using a Pipeline in machine learning workflows, such as those in Scikit-Learn?

A. To automatically select the best algorithm for the dataset
B. To visualize the neural network architecture
C. To chain together multiple processing steps (transformers) and a final estimator
D. To deploy the model directly to a cloud server

2 When using a Pipeline, how is data leakage prevented during Cross-Validation?

A. By fitting transformers only on the training folds and applying them to the validation fold
B. By shuffling the data repeatedly
C. By fitting the transformer on the entire dataset before splitting
D. By using only the final estimator during cross-validation

3 In a Scikit-Learn Pipeline, which method is called on the intermediate steps during the training phase?

A. score()
B. transform()
C. predict()
D. fit_transform()

4 Which of the following classes allows you to apply different transformers to different columns of an array or pandas DataFrame?

A. FunctionTransformer
B. FeatureUnion
C. GridSearchCV
D. ColumnTransformer

5 In -Fold Cross-Validation, if , what percentage of the data is used for training in each iteration?

A. 80%
B. 50%
C. 100%
D. 20%

6 Which Cross-Validation strategy is recommended for classification problems where the target classes are imbalanced?

A. Leave-One-Out
B. K-Fold
C. TimeSeriesSplit
D. Stratified K-Fold

7 What is a significant drawback of Leave-One-Out Cross-Validation (LOOCV) on large datasets?

A. It cannot handle categorical data
B. It has high bias
C. It is computationally expensive
D. It reduces the variance of the estimator significantly

8 When debugging an algorithm, a Learning Curve plots the model performance (score) against:

A. The time taken to train
B. The values of a specific hyperparameter
C. The number of training samples
D. The number of features

9 If a Learning Curve shows a high training score but a low validation score with a large gap between them, the model is suffering from:

A. High Bias (Underfitting)
B. High Variance (Overfitting)
C. Data leakage
D. Convergence failure

10 If both the training score and validation score converge to a low value (high error) on a Learning Curve, what is the diagnosis?

A. High Bias (Underfitting)
B. Optimal performance
C. Need for regularization
D. High Variance (Overfitting)

11 A Validation Curve is used to evaluate the effect of:

A. Different random seeds
B. A single hyperparameter
C. Training set size
D. Feature scaling

12 In the context of the Bias-Variance tradeoff, increasing the complexity of a model usually leads to:

A. Higher Bias and Lower Variance
B. Lower Bias and Lower Variance
C. Higher Bias and Higher Variance
D. Lower Bias and Higher Variance

13 Which of the following actions is most likely to fix a model suffering from High Variance?

A. Decreasing the regularization parameter
B. Reducing the size of the training set
C. Adding more polynomial features
D. Getting more training data

14 Which of the following actions is most likely to fix a model suffering from High Bias?

A. Using a simpler algorithm
B. Increasing the regularization parameter
C. Adding polynomial features or increasing model complexity
D. Removing features

15 What is Model Serialization?

A. Converting a trained model into a format that can be stored or transmitted
B. Training a model in a serial sequence rather than parallel
C. Assigning a unique serial number to a model version
D. Converting categorical features into serial integers

16 Which Python library is commonly used for serializing Scikit-Learn models, particularly efficient for NumPy arrays?

A. json
B. pandas
C. joblib
D. csv

17 What is the inverse process of serialization called, where a saved model is loaded back into memory?

A. Deserialization
B. Decoding
C. Unzipping
D. Parsing

18 What is a major security risk associated with deserializing data using pickle or joblib?

A. The model accuracy decreases
B. It converts float64 to float32
C. Arbitrary code execution if the file is malicious
D. The file size becomes too large

19 Which format is specifically designed as an open standard for representing machine learning models to allow interoperability between different frameworks (e.g., PyTorch to ONNX Runtime)?

A. ONNX (Open Neural Network Exchange)
B. HDF5
C. CSV
D. Pickle

20 What does Model Deployment generally refer to?

A. Integrating a machine learning model into an existing production environment to make practical business decisions
B. Hyperparameter tuning using GridSearch
C. Writing the documentation for the model
D. The process of cleaning data

21 In a Web Service deployment (e.g., using Flask or FastAPI), how does a client typically request a prediction?

A. By emailing the dataset to the server
B. By downloading the model file and running it locally
C. By connecting via SSH to the server console
D. By sending an HTTP request (usually POST) with data in JSON format

22 What is Containerization (e.g., using Docker) useful for in model deployment?

A. It converts Python code to C++
B. It compresses the model to a smaller file size
C. It increases the model's accuracy automatically
D. It packages the model with all its dependencies (libraries, OS settings) to ensure consistency across environments

23 What characterizes Serverless deployment (e.g., AWS Lambda, Azure Functions)?

A. It requires a dedicated server running 24/7
B. The cloud provider dynamically manages the allocation of machine resources, and you pay only for the compute time used
C. The model runs without any hardware physically existing anywhere
D. The developer manages the physical servers and operating system updates

24 Which of the following is a disadvantage of Local Deployment (running the model on the user's device, e.g., mobile app)?

A. Dependence on internet connectivity
B. Limited computational resources (battery, CPU/RAM) on the device
C. High latency due to network transfer
D. Data privacy concerns

25 In the context of deployment, what is Concept Drift?

A. The loss of floating-point precision during serialization
B. The statistical properties of the target variable change over time, making the model less accurate
C. Moving the model from one cloud provider to another
D. The model code changing over time due to git commits

26 What is Batch Prediction (Offline Inference)?

A. Generating a prediction immediately when a user clicks a button
B. Grouping multiple models together
C. Training the model in batches
D. Generating predictions for a large set of observations at once, often on a schedule

27 Which HTTP method is most appropriate for a REST API endpoint that accepts input features and returns a model prediction?

A. POST
B. DELETE
C. HEAD
D. GET

28 Why is Pipeline serialization preferred over serializing just the model estimator?

A. Pipelines cannot be serialized
B. It ensures that raw data fed into the loaded object undergoes the exact same preprocessing steps as training data
C. It is faster to load
D. It makes the file smaller

29 In Scikit-Learn, how do you perform a Grid Search over parameters inside a Pipeline?

A. You cannot perform Grid Search on a Pipeline
B. Modify the source code of the library
C. Pass the parameters directly to the estimator
D. Use the syntax step_name__parameter_name in the param_grid

30 What is Nested Cross-Validation used for?

A. To tune hyperparameters without biasing the model evaluation
B. To use multiple models simultaneously
C. To visualize the data in 3D
D. To reduce the training time

31 Which cross-validation method is appropriate for time-series data?

A. Random K-Fold
B. Leave-One-Out
C. ShuffleSplit
D. TimeSeriesSplit (Rolling basis)

32 In a validation curve, if the training score is 0.99 and the validation score is 0.60, what should you do regarding the hyperparameter being tested?

A. Adjust the parameter to increase model complexity
B. Adjust the parameter to decrease model complexity (increase regularization)
C. Keep the parameter as is
D. Stop collecting data

33 What is the primary benefit of Microservices architecture for ML deployment?

A. It allows the ML model to be developed, deployed, and scaled independently of the main application
B. It removes the need for APIs
C. It eliminates the need for data preprocessing
D. It puts all code into one giant script

34 Which file extension is commonly associated with a Python pickled model?

A. .css
B. .html
C. .pkl
D. .txt

35 A Canary Deployment strategy involves:

A. Releasing the model to a small percentage of users first to monitor performance before full rollout
B. Running the model only on weekends
C. Replacing the old model instantly for all users
D. Deploying the model to a coal mine

36 In Scikit-Learn, Pipeline(steps=[('scaler', StandardScaler()), ('svc', SVC())]). What object does steps expect?

A. A pandas DataFrame
B. A JSON string
C. A dictionary of parameters
D. A list of (name, transform) tuples

37 Which metric on a learning curve would indicate that obtaining more data is NOT worth the cost?

A. The validation score is fluctuating wildly
B. The validation score has plateaued and converged with the training score
C. The training score is increasing rapidly
D. The gap between training and validation score is widening

38 What is the purpose of make_pipeline in Scikit-Learn compared to the Pipeline class constructor?

A. It creates a pipeline that runs faster
B. It automatically names the steps based on the class names of the estimators
C. It does not support cross-validation
D. It only supports regression models

39 When deploying a model via a REST API, what is Latency?

A. The number of requests the server can handle per second
B. The time taken from sending the request to receiving the prediction
C. The cost of the server
D. The accuracy of the model

40 What is PMML (Predictive Model Markup Language)?

A. A cloud service provider
B. A python library for plotting
C. An XML-based standard for representing predictive models
D. A type of neural network

41 In Repeated K-Fold Cross-Validation:

A. The same K-Fold split is repeated exactly
B. Data is duplicated times before splitting
C. K-Fold CV is run times with different randomization splits
D. The model is trained repeatedly on the same fold

42 What is the formula for Total Error in the context of Bias-Variance decomposition?

A.
B.
C.
D.

43 Which Scikit-Learn utility helps ensure that the training and testing sets have the same distribution of classes?

A. train_test_split(..., stratify=y)
B. StandardScaler()
C. Pipeline()
D. train_test_split(..., shuffle=False)

44 Why might a FunctionTransformer be included in a Pipeline?

A. To debug the pipeline
B. To execute a custom Python function (like log transformation) as a step
C. To transform the pipeline into a function
D. To plot the data

45 When serializing a model that relies on external code files (custom classes), what common issue arises?

A. The pickle file works everywhere automatically
B. The model becomes a regression model
C. The pickle file may fail to load if the custom class definition is not available in the loading environment
D. The file size doubles

46 Which of the following is an example of Online Learning deployment?

A. Training a model once a year
B. The model updates its weights incrementally as new data streams in
C. Uploading the model to the internet
D. Using a static HTML page

47 What is the purpose of the random_state parameter in Cross-Validation splitters?

A. To improve accuracy
B. To randomise the hyperparameters
C. To delete random data
D. To ensure reproducibility of the splits

48 In a pipeline, what happens if you call predict()?

A. It returns an error
B. It calls predict() on all steps
C. It calls transform() on all transformers and predict() on the final estimator
D. It calls fit() on all steps

49 Which tool is commonly used to create an isolated environment for Python dependencies to avoid version conflicts during development and deployment?

A. Pipenv / Virtualenv / Conda
B. Excel
C. Notepad
D. Chrome

50 What is the typical use of A/B Testing in model deployment?

A. Debugging syntax errors
B. Comparing two different models (Model A and Model B) on live traffic to see which performs better
C. Checking if the model works on inputs A and B
D. Testing the model in Alpha and Beta stages