Question 2
Given below a y_train list which consists of pizza’s ordered by the customers in a shop.
y_train = [['regular', 'veg'], ['medium', 'veg'], ['regular', 'non-veg'], ['medium', 'non-veg']]MultiLabelBinarizer from sklearn library has been used to convert the y_train into numbers, so which of the following option matches with the output using the following code ?
from sklearn.preprocessing import MultiLabelBinarizermlb = MultiLabelBinarizer(classes=['regular','medium', 'veg', 'non-veg'])print(mlb.fit_transform(y_train))Question 3
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:
from sklearn.pipeline import Pipelinefrom sklearn.svm import SVCfrom sklearn.preprocessing import StandardScalerimport numpy as np
# Simulated data (features: X, target: y)X = np.array([[2, 3], [5, 7], [8, 10]])y = np.array([0, 1, 0])
# Create a pipeline with StandardScaler and SVM classifierpipeline = Pipeline([ ('scaler', StandardScaler()), ('svm', SVC())])# Fit the pipeline on training datapipeline.fit(X, y)
# Make predictions using the trained pipelinepredictions = pipeline.predict(X)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 modeling steps.
The pipeline ensures that only linear SVM can be used for this classification task.
31 more questions in this paper
Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.
More on the MLP End Term 3 Sept 2023 Set QPD1-S2 paper
The IIT Madras BS Machine Learning Practice (MLP) End Term paper sat on 3 Sept 2023, in the May 2023 term, set QPD1-S2: 34 questions for 100 marks in 180 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.
| Feature | MLP End Term 3 Sept 2023 Set QPD1-S2 at a glance |
|---|---|
| Term | May 2023 term |
| Subject | Machine Learning Practice |
| Course code | BSCS2008 |
| Questions | 34 |
| Marks | 100 |
| Duration | 180 min |
| Numerical | 4 |
| MCQ | 24 |
| MSQ | 6 |
| Official paper | IIT M DIPLOMA ET1 EXAM QPD1 S2 03 Sep |
| Negative marking | No negative marking. |
| Updated |