Question.1 Your company built a TensorFlow neutral-network model with a large number of neurons and layers. The model fits well for the training data. However, when tested against new data, it performs poorly. What method can you employ to address this? (A) Threading (B) Serialization (C) Dropout Methods (D) Dimensionality Reduction |
1. Click here to View Answer
Answer is (C) Dropout Methods
There are various ways to prevent overfitting when dealing with DNNs. In this post, we’ll review these techniques and then apply them specifically to TensorFlow models:
– Early Stopping
– L1 and L2 Regularization
– Dropout
– Max-Norm Regularization
– Data Augmentation
D is not correct here because it is used for normal ml models whereas dropout methods is used for neural networks.
Question.2 An external customer provides you with a daily dump of data from their database. The data flows into Google Cloud Storage GCS as comma-separated values (CSV) files. You want to analyze this data in Google BigQuery, but the data could have rows that are formatted incorrectly or corrupted. How should you build this pipeline? (A) Use federated data sources, and check data in the SQL query. (B) Enable BigQuery monitoring in Google Stackdriver and create an alert. (C) Import the data into BigQuery using the gcloud CLI and set max_bad_records to 0. (D) Run a Google Cloud Dataflow batch pipeline to import the data into BigQuery, and push errors to another dead-letter table for analysis. |
2. Click here to View Answer
Answer is (D) Run a Google Cloud Dataflow batch pipeline to import the data into BigQuery, and push errors to another dead-letter table for analysis.
A. Use federated data sources, and check data in the SQL query. – WRONG (Because we are changing source itself, i.e. SQL, MySQL, PstgresSQL) instead of correcting the problem
B. Enable BigQuery monitoring in Google Stackdriver and create an alert. (WRONG – Because setting and creating an alert will not solve the corrupted data problem)
C. Import the data into BigQuery using the gcloud CLI and set max_bad_records to 0. (wrong – here we are saying set max_bad_records = 0 (i.e let’s load all bad records into bi-query)
D. Run a Google Cloud Dataflow batch pipeline to import the data into BigQuery, and push errors to another dead-letter table for analysis. (CORRECT – Dataflow is used for this pupose only i.e transform the data and dead letter queue pupose is to write any invalid records – so that it can be analyzed later (rather than ignoring))
Reference:
https://cloud.google.com/blog/products/gcp/handling-invalid-inputs-in-dataflow
Question.3 Your weather app queries a database every 15 minutes to get the current temperature. The frontend is powered by Google App Engine and server millions of users. How should you design the frontend to respond to a database failure? Issue a command to restart the database servers. Retry the query with exponential backoff, up to a cap of 15 minutes. Retry the query every second until it comes back online to minimize staleness of data. Reduce the query frequency to once every hour until the database comes back online. |
3. Click here to View Answer
Answer is (B) Retry the query with exponential backoff, up to a cap of 15 minutes.
App engine create applications that use Cloud SQL database connections effectively. Below is what is written in google cloud documnetation.
If your application attempts to connect to the database and does not succeed, the database could be temporarily unavailable. In this case, sending too many simultaneous connection requests might waste additional database resources and increase the time needed to recover. Using exponential backoff prevents your application from sending an unresponsive number of connection requests when it can’t connect to the database.
This retry only makes sense when first connecting, or when first grabbing a connection from the pool. If errors happen in the middle of a transaction, the application must do the retrying, and it must retry from the beginning of a transaction. So even if your pool is configured properly, the application might still see errors if connections are lost.
Reference:
https://cloud.google.com/sql/docs/mysql/manage-connections#backoff
Question.4 You are building new real-time data warehouse for your company and will use Google BigQuery streaming inserts. There is no guarantee that data will only be sent in once but you do have a unique ID for each row of data and an event timestamp. You want to ensure that duplicates are not included while interactively querying data. Which query type should you use? Include ORDER BY DESK on timestamp column and LIMIT to 1. Use GROUP BY on the unique ID column and timestamp column and SUM on the values. Use the LAG window function with PARTITION by unique ID along with WHERE LAG IS NOT NULL. Use the ROW_NUMBER window function with PARTITION by unique ID along with WHERE row equals 1. |
4. Click here to View Answer
Answer is (D) Use the ROW_NUMBER window function with PARTITION by unique ID along with WHERE row equals 1.
Row Number equals 1 with partitioning will ensure only one record is fetched per partition
Reference:
https://www.youtube.com/watch?v=ysArdMImULo&list=PLQMsfKRZZviSLraRoqXulcMKFvIXQkHdA&index=3
Question.5 You are designing a basket abandonment system for an ecommerce company. The system will send a message to a user based on these rules: • No interaction by the user on the site for 1 hour • Has added more than $30 worth of products to the basket • Has not completed a transaction You use Google Cloud Dataflow to process the data and decide if a message should be sent. How should you design the pipeline? (A) Use a fixed-time window with a duration of 60 minutes. (B) Use a sliding time window with a duration of 60 minutes. (C) Use a session window with a gap time duration of 60 minutes. (D) Use a global window with a time based trigger with a delay of 60 minutes. |
5. Click here to View Answer
Answer is C
There are 3 windowing concepts in dataflow and each can be used for below use case
1) Fixed window
2) Sliding window and
3) Session window.
Fixed window = any aggregation use cases, any batch analysis of data, relatively simple use cases.
Sliding window = Moving averages of data
Session window = user session data, click data and real time gaming analysis.
The question here is about user session data and hence session window.
Reference:
https://cloud.google.com/dataflow/docs/concepts/streaming-pipelines