exam questions

Exam DP-100 All Questions

View all questions & answers for the DP-100 exam

Exam DP-100 topic 3 question 40 discussion

Actual exam question from Microsoft's DP-100
Question #: 40
Topic #: 3
[All DP-100 Questions]

HOTSPOT -
You have a dataset created for multiclass classification tasks that contains a normalized numerical feature set with 10,000 data points and 150 features.
You use 75 percent of the data points for training and 25 percent for testing. You are using the scikit-learn machine learning library in Python. You use X to denote the feature set and Y to denote class labels.
You create the following Python data frames:

You need to apply the Principal Component Analysis (PCA) method to reduce the dimensionality of the feature set to 10 features in both training and testing sets.
How should you complete the code segment? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: PCA(n_components = 10)
Need to reduce the dimensionality of the feature set to 10 features in both training and testing sets.
Example:
from sklearn.decomposition import PCA
pca = PCA(n_components=2) ;2 dimensions
principalComponents = pca.fit_transform(x)

Box 2: pca -
fit_transform(X[, y]) fits the model with X and apply the dimensionality reduction on X.
Box 3: transform(x_test)
transform(X) applies dimensionality reduction to X.
Reference:
https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Yong2020
Highly Voted 4 years, 6 months ago
n_components should be 10 (the features to reduce to)
upvoted 9 times
...
ljljljlj
Highly Voted 3 years, 4 months ago
On exam 2021/7/10
upvoted 5 times
...
NullVoider_0
Most Recent 10 months, 1 week ago
Given answer is correct.
upvoted 1 times
...
AzureJobsTillRetire
1 year, 9 months ago
There are typos in the question. Name: x_train should be x_test. Description: testing feature set Name: y_train should be y_test. Description: testing class labels
upvoted 3 times
...
ning
2 years, 5 months ago
Seems correct
upvoted 2 times
...
WeiD
2 years, 6 months ago
There is no x_test in the question, a typo?
upvoted 2 times
PremPatrick
2 years ago
Seems like typo in the question!
upvoted 1 times
...
...
trickerk
3 years, 3 months ago
Given answer is correct!
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago