40 questions pulled from past papers whose wording matches this week's topics, newest first, duplicates removed. Pick your answers, then press Check answers. Figures and answer keys are the originals.
The pipeline first imputes the missing value with the (mean) strategy and then standardizes the column. What is the value of (the transformed value of the first sample, whose original value is 2)? (Enter up to 2 decimals)
You are performing hyperparameter tuning using GridSearchCV for a machine learning model. The following parameter grid is provided:
How many unique hyperparameter combinations will GridSearchCV evaluate in total?
Consider following parameter grid for regression with RandomForest:
Consider following parameter grid for regression with RandomForest: How many unique combinations of hyperparameters are there in the above parameter grid?
You’re building a machine learning pipeline to preprocess data and train a model on a classification task. You decide to use a pipeline that includes data preprocessing and a support vector machine (SVM) classifier. The following code snippet demonstrates the pipeline creation and usage:
You’re building a machine learning pipeline to preprocess data and train a model on a classification task. You decide to use a pipeline that includes data preprocessing and a support vector machine (SVM) classifier. The following code snippet demonstrates the pipeline creation and usage: What is the purpose of using the pipeline in this code snippet?
The pipeline combines multiple models for better model performance.
The pipeline allows for simultaneous training of the scaler and classifier.
The pipeline simplifies the code by encapsulating preprocessing and modelingsteps.
The pipeline ensures that only linear SVM can be used for this classificationtask.
Faster to compute the list of neighbors on scaled data.
k-nearest neighbors is based on computing some distances. Features need tobe normalized to contribute approximately equally to the distance computation.
Scaling the data has a negligible effect on k-nearest neighbor’s performance,but it enhances the interpretability of the model.
This is irrelevant. One could use k-nearest neighbors without normalizing thedataset and get a very similar cross-validation score.
Choose the options with respect to the given statements: Statement1 : To apply various sklearn methods from in series on a column we should use Pipeline. Statement2 : To apply various sklearn methods on various columns in parallel we should use ColumnTransformer.
The pipeline will generate polynomial features (including squared terms) andthen scale these features to a range between 0 and 1.
The transformed data will consist of the original features, their squares, andinteraction terms, all scaled between 0 and 1.
The pipeline scales the original features between 0 and 1, then subsequentlygenerates polynomial combinations including both square terms and interaction terms.
Only interaction terms between features are generated by the pipeline, whichare then scaled between 0 and 1, without including the squared terms of individual features.
You’re working on a binary classification problem where the dataset is relatively small, and you suspect that a linear decision boundary will work well due to distinct class separation. Additionally, you want to perform logistic regression with L1 regularization for improved feature selection. Which solver is most appropriate for this scenario?
Brajesh wants to tune hyper parameters of an AdaBoost model for a classification problem with following specifications: 1. Base estimator as Decision trees classifier with max_depth=1. 2. Number of estimators range from 30 to 40 (both inclusive) at the interval of 1. 3. Cross validation = 5. 4. Learning rate must vary between 0.2 to 2.0 (both inclusive) at the intervals of 0.2. 5. Train the best model on the entire training set. 6. Print score on test set. Which of the following code blocks will correctly execute Brajesh’s task? [Note: Assume necessary imports and variables for training and test sets.]
Rajesh wants to tune hyper parameters of an AdaBoost model for a classification problem with following specifications: 1. Base estimator as Decision trees classifier with max_depth=1. 2. Number of estimators range from 10 to 20 (both inclusive) at the interval of 1. 3. Cross validation =4. 4. Learning rate must vary between 0.1 to 1.0 (both inclusive) at the intervals of 0.1. 5. Train the best model on the entire training set. 6. Print score on test set. Which of the following code blocks will correctly execute Rajesh’s task? [Note: Assume necessary imports and variables for training and test sets.]