Quiz Space

Machine Learning Practice · End Term · 13 Apr 2025 · January 2025 term · Set QDD1

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

Question 23

+1 markNumerical answer

Consider the following code snippet:

python
from sklearn.datasets import fetch_california_housing, load_iris
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler, PolynomialFeatures
from sklearn.pipeline import Pipeline, FeatureUnion
X,y = load_iris(return_X_y= True)
polynomial_transform = PolynomialFeatures(degree=3,
interaction_only=False,
include_bias=False)
combined_features = FeatureUnion([('poly', polynomial_transform),
('pca', PCA(n_components=2))])
pipeline = Pipeline([('features', combined_features),
('scaler', MinMaxScaler())])
X_transformed = pipeline.fit_transform(X)
print(X_transformed.shape)

If the shape of X is (150,4)(150, 4), what will be the number of features in X_transformed?

Show answer

Correct answer: 36

Question 23 of 30 in the IIT Madras BS Machine Learning Practice (MLP) End Term paper sat on 13 Apr 2025, in the January 2025 term (IIT M DIPLOMA AN EXAM QDD3 13 Apr 2025). It carries 1 mark.

This question was also asked in

More questions from this paper

  1. Q1Given the following code snippet that preprocesses a dataset with both continuous and categorical features using sklear…
  2. Q2What will be the output of the following code?
  3. Q3Imagine you are using a Dummy Regressor with strategy=median. Given the following dataset: | S.No | X_1 | X_2 | X_3 | Y…
  4. Q4You want to implement an SGDRegressor using scikit-learn with the following specifications: Maximum iterations: 1000 Ea…
  5. Q5What is the primary computational bottleneck of the KNeighborsClassifier?
  6. Q6Figure question
  7. Q7The following code attempts to implement polynomial regression (degree 4) on the California housing dataset. Please sel…
  8. Q8Given the following information, what will be the output of the code snippet? continuous: y is an array-like of floats …
  9. Q9Figure question
  10. Q10What will be the output of the following code snippet?
  11. Q11The following code snippet shows the use of two models built on the data X and label y: For the given data, which of th…
  12. Q12Figure question
  13. Q13Figure question
  14. Q14Figure question
  15. Q15Consider the following Python code snippet and the given dataset that has been stored in the data variable that demonst…
  16. Q16Figure question
  17. Q17Figure question
  18. Q18Which of the following techniques can be used for hyperparameter tuning in Ridge Regression? Select all correct options.
  19. Q19Figure question
  20. Q20In top-down (divisive) hierarchical clustering, clusters are recursively split until each data point is its own cluster…
  21. Q21You are training a Multi-Layer Perceptron (MLP) using Scikit-Learn's MLPClassifier for a binary classification task. Ho…
  22. Q22Which of the following statements are true with regard to logistic regression?
  23. Q24Use the confusion matrix given below. What is the recall score for the label (class) 1 ?
  24. Q25Based on the above data, answer the given subquestions.
  25. Q26Based on the above data, answer the given subquestions.
  26. Q27What is the output of the following code snippet: Enter -1, if you think the above statement will generate an error.
  27. Q28Consider following common data: Consider the above classification report on a model where y_test contains the original …
  28. Q29Consider following common data: Consider the above classification report on a model where y_test contains the original …
  29. Q30Consider following common data: Consider the above classification report on a model where y_test contains the original …