MLS-C01 : AWS Certified Machine Learning – Specialty : Part 04



MLS-C01 : AWS Certified Machine Learning – Specialty : Part 04

  1. A Machine Learning Specialist is working with a large cybersecurity company that manages security events in real time for companies around the world. The cybersecurity company wants to design a solution that will allow it to use machine learning to score malicious events as anomalies on the data as it is being ingested. The company also wants be able to save the results in its data lake for later processing and analysis.

    What is the MOST efficient way to accomplish these tasks?

    • Ingest the data using Amazon Kinesis Data Firehose, and use Amazon Kinesis Data Analytics Random Cut Forest (RCF) for anomaly detection. Then use Kinesis Data Firehose to stream the results to Amazon S3.
    • Ingest the data into Apache Spark Streaming using Amazon EMR, and use Spark MLlib with k-means to perform anomaly detection. Then store the results in an Apache Hadoop Distributed File System (HDFS) using Amazon EMR with a replication factor of three as the data lake.
    • Ingest the data and store it in Amazon S3. Use AWS Batch along with the AWS Deep Learning AMIs to train a k-means model using TensorFlow on the data in Amazon S3.
    • Ingest the data and store it in Amazon S3. Have an AWS Glue job that is triggered on demand transform the new data. Then use the built-in Random Cut Forest (RCF) model within Amazon SageMaker to detect anomalies in the data.
  2. A Data Scientist wants to gain real-time insights into a data stream of GZIP files.

    Which solution would allow the use of SQL to query the stream with the LEAST latency?

    • Amazon Kinesis Data Analytics with an AWS Lambda function to transform the data.
    • AWS Glue with a custom ETL script to transform the data.
    • An Amazon Kinesis Client Library to transform the data and save it to an Amazon ES cluster.
    • Amazon Kinesis Data Firehose to transform the data and put it into an Amazon S3 bucket.
  3. A retail company intends to use machine learning to categorize new products. A labeled dataset of current products was provided to the Data Science team. The dataset includes 1,200 products. The labeled dataset has 15 features for each product such as title dimensions, weight, and price. Each product is labeled as belonging to one of six categories such as books, games, electronics, and movies.

    Which model should be used for categorizing new products using the provided dataset for training?

    • AnXGBoost model where the objective parameter is set to multi:softmax
    • A deep convolutional neural network (CNN) with a softmax activation function for the last layer
    • A regression forest where the number of trees is set equal to the number of product categories
    • A DeepAR forecasting model based on a recurrent neural network (RNN)
  4. A Data Scientist is working on an application that performs sentiment analysis. The validation accuracy is poor, and the Data Scientist thinks that the cause may be a rich vocabulary and a low average frequency of words in the dataset.

    Which tool should be used to improve the validation accuracy?

    • Amazon Comprehend syntax analysis and entity detection
    • Amazon SageMaker BlazingText cbow mode
    • Natural Language Toolkit (NLTK) stemming and stop word removal
    • Scikit-leam term frequency-inverse document frequency (TF-IDF) vectorizer
  5. Machine Learning Specialist is building a model to predict future employment rates based on a wide range of economic factors. While exploring the data, the Specialist notices that the magnitude of the input features vary greatly. The Specialist does not want variables with a larger magnitude to dominate the model.

    What should the Specialist do to prepare the data for model training?

    • Apply quantile binning to group the data into categorical bins to keep any relationships in the data by replacing the magnitude with distribution.
    • Apply the Cartesian product transformation to create new combinations of fields that are independent of the magnitude.
    • Apply normalization to ensure each field will have a mean of 0 and a variance of 1 to remove any significant magnitude.
    • Apply the orthogonal sparse bigram (OSB) transformation to apply a fixed-size sliding window to generate new features of a similar magnitude.
  6. A Machine Learning Specialist must build out a process to query a dataset on Amazon S3 using Amazon Athena. The dataset contains more than 800,000 records stored as plaintext CSV files. Each record contains 200 columns and is approximately 1.5 MB in size. Most queries will span 5 to 10 columns only.

    How should the Machine Learning Specialist transform the dataset to minimize query runtime?

    • Convert the records to Apache Parquet format.
    • Convert the records to JSON format.
    • Convert the records to GZIP CSV format.
    • Convert the records to XML format.
    Explanation:
    Using compressions will reduce the amount of data scanned by Amazon Athena, and also reduce your S3 bucket storage. It’s a Win-Win for your AWS bill. Supported formats: GZIP, LZO, SNAPPY (Parquet) and ZLIB.
  7. A Machine Learning Specialist is developing a daily ETL workflow containing multiple ETL jobs. The workflow consists of the following processes:

    • Start the workflow as soon as data is uploaded to Amazon S3.
    • When all the datasets are available in Amazon S3, start an ETL job to join the uploaded datasets with multiple terabyte-sized datasets already stored in Amazon S3.
    • Store the results of joining datasets in Amazon S3.
    • If one of the jobs fails, send a notification to the Administrator.

    Which configuration will meet these requirements?

    • Use AWS Lambda to trigger an AWS Step Functions workflow to wait for dataset uploads to complete in Amazon S3. Use AWS Glue to join the datasets. Use an Amazon CloudWatch alarm to send an SNS notification to the Administrator in the case of a failure.
    • Develop the ETL workflow using AWS Lambda to start an Amazon SageMaker notebook instance. Use a lifecycle configuration script to join the datasets and persist the results in Amazon S3. Use an Amazon CloudWatch alarm to send an SNS notification to the Administrator in the case of a failure.
    • Develop the ETL workflow using AWS Batch to trigger the start of ETL jobs when data is uploaded to Amazon S3. Use AWS Glue to join the datasets in Amazon S3. Use an Amazon CloudWatch alarm to send an SNS notification to the Administrator in the case of a failure.
    • Use AWS Lambda to chain other Lambda functions to read and join the datasets in Amazon S3 as soon as the data is uploaded to Amazon S3. Use an Amazon CloudWatch alarm to send an SNS notification to the Administrator in the case of a failure.
  8. An agency collects census information within a country to determine healthcare and social program needs by province and city. The census form collects responses for approximately 500 questions from each citizen.

    Which combination of algorithms would provide the appropriate insights? (Choose two.)

    • The factorization machines (FM) algorithm
    • The Latent Dirichlet Allocation (LDA) algorithm
    • The principal component analysis (PCA) algorithm
    • The k-means algorithm
    • The Random Cut Forest (RCF) algorithm
    Explanation:
    The PCA and K-means algorithms are useful in collection of data using census form.
  9. A large consumer goods manufacturer has the following products on sale:

    • 34 different toothpaste variants
    • 48 different toothbrush variants
    • 43 different mouthwash variants

    The entire sales history of all these products is available in Amazon S3. Currently, the company is using custom-built autoregressive integrated moving average (ARIMA) models to forecast demand for these products. The company wants to predict the demand for a new product that will soon be launched.

    Which solution should a Machine Learning Specialist apply?

    • Train a custom ARIMA model to forecast demand for the new product.
    • Train an Amazon SageMaker DeepAR algorithm to forecast demand for the new product.
    • Train an Amazon SageMaker k-means clustering algorithm to forecast demand for the new product.
    • Train a custom XGBoost model to forecast demand for the new product.
    Explanation:
    The Amazon SageMaker DeepAR forecasting algorithm is a supervised learning algorithm for forecasting scalar (one-dimensional) time series using recurrent neural networks (RNN). Classical forecasting methods, such as autoregressive integrated moving average (ARIMA) or exponential smoothing (ETS), fit a single model to each individual time series. They then use that model to extrapolate the time series into the future.
  10. A Machine Learning Specialist uploads a dataset to an Amazon S3 bucket protected with server-side encryption using AWS KMS.

    How should the ML Specialist define the Amazon SageMaker notebook instance so it can read the same dataset from Amazon S3?

    • Define security group(s) to allow all HTTP inbound/outbound traffic and assign those security group(s) to the Amazon SageMaker notebook instance.
    • Сonfigure the Amazon SageMaker notebook instance to have access to the VPC. Grant permission in the KMS key policy to the notebook’s KMS role.
    • Assign an IAM role to the Amazon SageMaker notebook with S3 read access to the dataset. Grant permission in the KMS key policy to that role.
    • Assign the same KMS key used to encrypt data in Amazon S3 to the Amazon SageMaker notebook instance.
  11. A Data Scientist needs to migrate an existing on-premises ETL process to the cloud. The current process runs at regular time intervals and uses PySpark to combine and format multiple large data sources into a single consolidated output for downstream processing.

    The Data Scientist has been given the following requirements to the cloud solution:
    – Combine multiple data sources.
    – Reuse existing PySpark logic.
    – Run the solution on the existing schedule.
    – Minimize the number of servers that will need to be managed.

    Which architecture should the Data Scientist use to build this solution?

    • Write the raw data to Amazon S3. Schedule an AWS Lambda function to submit a Spark step to a persistent Amazon EMR cluster based on the existing schedule. Use the existing PySpark logic to run the ETL job on the EMR cluster. Output the results to a “processed” location in Amazon S3 that is accessible for downstream use.
    • Write the raw data to Amazon S3. Create an AWS Glue ETL job to perform the ETL processing against the input data. Write the ETL job in PySpark to leverage the existing logic. Create a new AWS Glue trigger to trigger the ETL job based on the existing schedule. Configure the output target of the ETL job to write to a “processed” location in Amazon S3 that is accessible for downstream use.
    • Write the raw data to Amazon S3. Schedule an AWS Lambda function to run on the existing schedule and process the input data from Amazon S3. Write the Lambda logic in Python and implement the existing PySpark logic to perform the ETL process. Have the Lambda function output the results to a “processed” location in Amazon S3 that is accessible for downstream use.
    • Use Amazon Kinesis Data Analytics to stream the input data and perform real-time SQL queries against the stream to carry out the required transformations within the stream. Deliver the output results to a “processed” location in Amazon S3 that is accessible for downstream use.
  12. A Data Scientist is building a model to predict customer churn using a dataset of 100 continuous numerical features. The Marketing team has not provided any insight about which features are relevant for churn prediction. The Marketing team wants to interpret the model and see the direct impact of relevant features on the model outcome. While training a logistic regression model, the Data Scientist observes that there is a wide gap between the training and validation set accuracy.

    Which methods can the Data Scientist use to improve the model performance and satisfy the Marketing team’s needs? (Choose two.)

    • Add L1 regularization to the classifier
    • Add features to the dataset
    • Perform recursive feature elimination
    • Perform t-distributed stochastic neighbor embedding (t-SNE)
    • Perform linear discriminant analysis
  13. An aircraft engine manufacturing company is measuring 200 performance metrics in a time-series. Engineers want to detect critical manufacturing defects in near-real time during testing. All of the data needs to be stored for offline analysis.

    What approach would be the MOST effective to perform near-real time defect detection?

    • Use AWS IoT Analytics for ingestion, storage, and further analysis. Use Jupyter notebooks from within AWS IoT Analytics to carry out analysis for anomalies.
    • Use Amazon S3 for ingestion, storage, and further analysis. Use an Amazon EMR cluster to carry out Apache Spark ML k-means clustering to determine anomalies.
    • Use Amazon S3 for ingestion, storage, and further analysis. Use the Amazon SageMaker Random Cut Forest (RCF) algorithm to determine anomalies.
    • Use Amazon Kinesis Data Firehose for ingestion and Amazon Kinesis Data Analytics Random Cut Forest (RCF) to perform anomaly detection. Use Kinesis Data Firehose to store data in Amazon S3 for further analysis.
  14. A Machine Learning team runs its own training algorithm on Amazon SageMaker. The training algorithm requires external assets. The team needs to submit both its own algorithm code and algorithm-specific parameters to Amazon SageMaker.

    What combination of services should the team use to build a custom algorithm in Amazon SageMaker? (Choose two.)

    • AWS Secrets Manager
    • AWS CodeStar
    • Amazon ECR
    • Amazon ECS
    • Amazon S3
  15. A Machine Learning Specialist wants to determine the appropriate SageMakerVariantInvocationsPerInstance setting for an endpoint automatic scaling configuration. The Specialist has performed a load test on a single instance and determined that peak requests per second (RPS) without service degradation is about 20 RPS. As this is the first deployment, the Specialist intends to set the invocation safety factor to 0.5.

    Based on the stated parameters and given that the invocations per instance setting is measured on a per-minute basis, what should the Specialist set as the SageMakerVariantInvocationsPerInstance setting?

    • 10
    • 30
    • 600
    • 2,400
  16. A company uses a long short-term memory (LSTM) model to evaluate the risk factors of a particular energy sector. The model reviews multi-page text documents to analyze each sentence of the text and categorize it as either a potential risk or no risk. The model is not performing well, even though the Data Scientist has experimented with many different network structures and tuned the corresponding hyperparameters.

    Which approach will provide the MAXIMUM performance boost?

    • Initialize the words by term frequency-inverse document frequency (TF-IDF) vectors pretrained on a large collection of news articles related to the energy sector.
    • Use gated recurrent units (GRUs) instead of LSTM and run the training process until the validation loss stops decreasing.
    • Reduce the learning rate and run the training process until the training loss stops decreasing.
    • Initialize the words by word2vec embeddings pretrained on a large collection of news articles related to the energy sector.
  17. A Machine Learning Specialist needs to move and transform data in preparation for training. Some of the data needs to be processed in near-real time, and other data can be moved hourly. There are existing Amazon EMR MapReduce jobs to clean and feature engineering to perform on the data.

    Which of the following services can feed data to the MapReduce jobs? (Choose two.)

    • AWS DMS
    • Amazon Kinesis
    • AWS Data Pipeline
    • Amazon Athena
    • Amazon ES
  18. A Machine Learning Specialist previously trained a logistic regression model using scikit-learn on a local machine, and the Specialist now wants to deploy it to production for inference only.

    What steps should be taken to ensure Amazon SageMaker can host a model that was trained locally?

    • Build the Docker image with the inference code. Tag the Docker image with the registry hostname and upload it to Amazon ECR.
    • Serialize the trained model so the format is compressed for deployment. Tag the Docker image with the registry hostname and upload it to Amazon S3.
    • Serialize the trained model so the format is compressed for deployment. Build the image and upload it to Docker Hub.
    • Build the Docker image with the inference code. Configure Docker Hub and upload the image to Amazon ECR.
  19. A trucking company is collecting live image data from its fleet of trucks across the globe. The data is growing rapidly and approximately 100 GB of new data is generated every day. The company wants to explore machine learning uses cases while ensuring the data is only accessible to specific IAM users.

    Which storage option provides the most processing flexibility and will allow access control with IAM?

    • Use a database, such as Amazon DynamoDB, to store the images, and set the IAM policies to restrict access to only the desired IAM users.
    • Use an Amazon S3-backed data lake to store the raw images, and set up the permissions using bucket policies.
    • Setup up Amazon EMR with Hadoop Distributed File System (HDFS) to store the files, and restrict access to the EMR instances using IAM policies.
    • Configure Amazon EFS with IAM policies to make the data available to Amazon EC2 instances owned by the IAM users.
  20. A credit card company wants to build a credit scoring model to help predict whether a new credit card applicant will default on a credit card payment. The company has collected data from a large number of sources with thousands of raw attributes. Early experiments to train a classification model revealed that many attributes are highly correlated, the large number of features slows down the training speed significantly, and that there are some overfitting issues.

    The Data Scientist on this project would like to speed up the model training time without losing a lot of information from the original dataset.

    Which feature engineering technique should the Data Scientist use to meet the objectives?

    • Run self-correlation on all features and remove highly correlated features
    • Normalize all numerical values to be between 0 and 1
    • Use an autoencoder or principal component analysis (PCA) to replace original features with new features
    • Cluster raw data using k-means and use sample data from each cluster to build a new dataset