Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Professional Machine Learning Engineer All Questions

View all questions & answers for the Professional Machine Learning Engineer exam

Exam Professional Machine Learning Engineer topic 1 question 22 discussion

Actual exam question from Google's Professional Machine Learning Engineer
Question #: 22
Topic #: 1
[All Professional Machine Learning Engineer Questions]

You trained a text classification model. You have the following SignatureDefs:

You started a TensorFlow-serving component server and tried to send an HTTP request to get a prediction using: headers = {"content-type": "application/json"} json_response = requests.post('http: //localhost:8501/v1/models/text_model:predict', data=data, headers=headers)
What is the correct way to write the predict request?

  • A. data = json.dumps({ג€signature_nameג€: ג€seving_defaultג€, ג€instancesג€ [['ab', 'bc', 'cd']]})
  • B. data = json.dumps({ג€signature_nameג€: ג€serving_defaultג€, ג€instancesג€ [['a', 'b', 'c', 'd', 'e', 'f']]})
  • C. data = json.dumps({ג€signature_nameג€: ג€serving_defaultג€, ג€instancesג€ [['a', 'b', 'c'], ['d', 'e', 'f']]})
  • D. data = json.dumps({ג€signature_nameג€: ג€serving_defaultג€, ג€instancesג€ [['a', 'b'], ['c', 'd'], ['e', 'f']]})
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
[Removed]
Highly Voted 3 years, 5 months ago
Options: A. data = json.dumps({“signature_name”: “seving_default”, “instances” [[‘ab’, ‘bc’, ‘cd’]]}) B. data = json.dumps({“signature_name”: “serving_default”, “instances” [[‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’]]}) C. data = json.dumps({“signature_name”: “serving_default”, “instances” [[‘a’, ‘b’, ‘c’], [‘d’, ‘e’, ‘f’]]}) D. data = json.dumps({“signature_name”: “serving_default”, “instances” [[‘a’, ‘b’], [‘c’, ‘d’], [‘e’, ‘f’]]})
upvoted 28 times
...
maartenalexander
Highly Voted 3 years, 5 months ago
Most likely D. A negative number in the shape enables auto expand (https://stackoverflow.com/questions/37956197/what-is-the-negative-index-in-shape-arrays-used-for-tensorflow). Then the first number -1 out of the shape (-1, 2) speaks the number of 1 dimensional arrays within the tensor (and it can autoexpand) while the second numer (2) sets the number of elements in the inner array at 2. Hence D.
upvoted 22 times
...
jkkim_jt
Most Recent 1 month ago
Selected Answer: D
the shape (-1, 2) indicates that the data can have any number of rows (denoted by -1), but must have exactly 2 columns. In machine learning, especially in frameworks like TensorFlow or Keras, the -1 acts as a placeholder for dynamic batch sizes, meaning the model can process inputs with any number of samples (rows), but each sample must have exactly 2 features (columns).
upvoted 2 times
...
PhilipKoku
5 months, 2 weeks ago
Selected Answer: D
D) Any rows, 2 columns.
upvoted 1 times
...
M25
1 year, 6 months ago
Selected Answer: D
Went with D
upvoted 2 times
...
wish0035
1 year, 11 months ago
Selected Answer: D
ans: D
upvoted 1 times
...
EFIGO
2 years ago
Selected Answer: D
Having "shape=[-1,2]", the input can have as many rows as we want, but each row needs to be of 2 elements. The only option satisfying this requirement is D.
upvoted 1 times
...
GCP72
2 years, 3 months ago
Selected Answer: D
Correct answer is "D"
upvoted 1 times
...
Mohamed_Mossad
2 years, 5 months ago
Selected Answer: D
will vote for D , as the data shape in instances matches the shape in signature def
upvoted 1 times
...
pml2021
2 years, 8 months ago
Selected Answer: D
shape is (-1,2) indicating any no of rows, 2 columns only.
upvoted 2 times
...
mousseUwU
3 years, 1 month ago
D is correct if shape(-1,2) means 2 columns for each row
upvoted 3 times
mousseUwU
3 years, 1 month ago
Link to explanation: https://stackoverflow.com/questions/37956197/what-is-the-negative-index-in-shape-arrays-used-for-tensorflow
upvoted 1 times
...
...
Danny2021
3 years, 2 months ago
D: (-1, 2) represents a vector with any number of rows but only 2 columns.
upvoted 5 times
...
inder0007
3 years, 5 months ago
Correct answer is D, the shapes otherwise don't matter
upvoted 4 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 ...