Quiz Space

Machine Learning Practice · End Term · 3 Sept 2023 · May 2023 term · Set QPD1-S1

Question 13: Consider the following code snippet: If the shape of X i…

Question 13

+3 marksOne correct option

Consider the following code snippet:

python
from sklearn.datasets import fetch_california_housing
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler, PolynomialFeatures
from sklearn.pipeline import Pipeline, FeatureUnion
data = fetch_california_housing()
X = data.data
polynomial_transform = PolynomialFeatures(degree=2, include_bias=False)
pca_transform = PCA(n_components=5)
scaler = StandardScaler()
combined_features = FeatureUnion([ ('poly', polynomial_transform),
('pca', pca_transform)])
pipeline = Pipeline([ ('features', combined_features),
('scaler', scaler)])
X_transformed = pipeline.fit_transform(X)
print(X_transformed.shape)

If the shape of X is (20640,8)(20640, 8), what will be the shape of X_transformed?

  1. A

    (20640, 8)

  2. B

    (20640, 5)

  3. C

    (20640, 44)

  4. D

    (20640, 49)

Show answer

Correct answer

  • D

    (20640, 49)

Video solution

The video solution to this question is being recorded and will play here. Until then, the answer key is above.

Question 13 of 34 in the IIT Madras BS Machine Learning Practice (MLP) End Term paper sat on 3 Sept 2023, in the May 2023 term (IIT M DIPLOMA ET1 EXAM QPD1 S2 03 Sep). It carries 3 marks.

This question was also asked in

More questions from this paper

  1. Q1What will be the output of the following code:
  2. Q2What will be the numerical value in the output array of the following code:
  3. Q3Given below a y_train list which consists of coffee order’s preference by the customers in a cafe. MultiLabelBinarizer …
  4. Q4Consider the following Python code snippet that demonstrates the use of GaussianNB from scikit-learn: In the context of…
  5. Q5Figure question
  6. Q6You’re working on a dataset containing customer purchase data, and you want to segment the customers into distinct grou…
  7. Q7You’re working with a dataset of geographical locations and want to group similar locations together based on their dis…
  8. Q8You’re analyzing a dataset of customer transaction histories. Each transaction includes the purchase amount and timesta…
  9. Q9Given the following code snippet, which statement is true regarding the use of LabelEncoder?
  10. Q10Figure question
  11. Q11Which of the following option(s) are correct regarding regularization?
  12. Q12Given the following code snippet that preprocesses a dataset with both continuous and categorical features using sklear…
  13. Q14What is the main principle behind a dummy regressor’s prediction strategy?
  14. Q15Consider the following Python code snippet that demonstrates the use of StandardScaler from scikit-learn: What does the…
  15. Q16Figure question
  16. Q17Figure question
  17. Q18Figure question
  18. Q19You’re working on a binary classification problem where the dataset is relatively small, and you suspect that a linear …
  19. Q20Figure question
  20. Q21You’re designing an ‘MLPClassifier’ for an image recognition task. The dataset consists of grayscale images of animals.…
  21. Q22You’re working on a binary classification task using the ‘MLPClassifier’ to predict whether a customer will make a purc…
  22. Q23For LinearRegression with equation Y = W_0X_0 + W_1X_1 + W_2X_2 + \epsilon and given that W_2 = \frac{5}{7} W_1 and \ep…
  23. Q24Using the confusion matrix given below. What is the precision score for the label (class) 1 ?
  24. Q25What will be the output of the following code snippet?
  25. Q26What is the output of the following code?
  26. Q27Which of the following statements are true?
  27. Q28Fill in the missing parameter value in the following estimator that can be used to classify the data
  28. Q29Consider the following code snippet where two decision trees are trained on the same dataset: Given the configurations …
  29. Q30Given the following code using BaggingClassifier with KNeighborsClassifier as the base estimator: Which of the followin…
  30. Q31Figure question
  31. Q32Figure question
  32. Q33Figure question
  33. Q34You’re working with a dataset of customer purchase behavior, including attributes “Total Amount Spent” and “Number of I…