Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 4 (12 pts). Assume that you are provided with two 2D arrays, X_num and X_cat, whose contents are as shown below. The array x_num
Problem 4 (12 pts). Assume that you are provided with two 2D arrays, X_num and X_cat, whose contents are as shown below. The array x_num contains the values for a single numerical (quantitative) feature, while X_cat contains the values for two categorical (qualitative) features. The feature arrays are preprocessed and combined into a single array by running the code below. Provide the contents of the array X_preprocessed by completing the table on the right. You may not need all of the columns provided. If not, leave any extra columns blank. from sklearn.preprocessing import PolynomialFeatures, OneHotEncoder poly= PolynomialFeatures(3) Xp poly.fit_transform(X_num) enc=OneHotEncoder(sparse=False) Xe= enc.fit_transform(X_cat) X_preprocessed | np.hstack((Xp, Xe)) X num X cat X_preprocessed 1 e 2 a a -3 b u 4 b a -1 a u Problem 4 (12 pts). Assume that you are provided with two 2D arrays, X_num and X_cat, whose contents are as shown below. The array x_num contains the values for a single numerical (quantitative) feature, while X_cat contains the values for two categorical (qualitative) features. The feature arrays are preprocessed and combined into a single array by running the code below. Provide the contents of the array X_preprocessed by completing the table on the right. You may not need all of the columns provided. If not, leave any extra columns blank. from sklearn.preprocessing import PolynomialFeatures, OneHotEncoder poly= PolynomialFeatures(3) Xp poly.fit_transform(X_num) enc=OneHotEncoder(sparse=False) Xe= enc.fit_transform(X_cat) X_preprocessed | np.hstack((Xp, Xe)) X num X cat X_preprocessed 1 e 2 a a -3 b u 4 b a -1 a u
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started