DSA-C03練習テスト問題は更新された289問題あります
Snowflake DSA-C03問題集で一発合格できる問題を試そう!
質問 # 109
You are troubleshooting an external function in Snowflake that calls a model hosted on Google Cloud A1 Platform. The external function consistently returns 'SQL compilation error: External function error: HTTP 400 Bad Request'. You have verified the API integration is correctly configured, and the Google Cloud project has the necessary permissions. Which of the following is the most likely cause of this error, and how would you best diagnose it?
- A. There is a mismatch between the request headers sent by Snowflake and what the Google Cloud AI Platform endpoint expects, specifically the 'Content-Type'. Diagnose by examining the headers being sent by Snowflake and ensuring they match the expected format.
- B. The request payload being sent by Snowflake exceeds the maximum size limit allowed by Google Cloud AI Platform. Diagnose by reducing the size of the input data and testing again.
- C. The issue is most likely due to incorrect data types being passed from Snowflake to the Google Cloud A1 Platform model. Diagnose by examining the input data being sent to the function and comparing it to the model's expected input schema.
- D. The Google Cloud AI Platform model is unavailable or experiencing issues. Diagnose by checking the Google Cloud status dashboard for AI Platform outages.
- E. The API integration in Snowflake is missing the necessary authentication credentials for Google Cloud. Diagnose by re-creating the API integration and ensuring the correct service account and scopes are configured.
正解:C
解説:
A 400 Bad Request error typically indicates that the server (Google Cloud A1 Platform in this case) received a request that it could not understand. This often means the data being sent is in an incorrect format or does not conform to the expected schema. While the other options could potentially cause issues, a 400 error is most directly linked to data type mismatches or schema violations. Diagnosing this involves carefully inspecting the data being sent by Snowflake and comparing it to the model's input requirements. Google Cloud logging or network tracing could be necessary in complex situations to identify discrepancies. The use of REQUEST and RESPONSE translators can mitigate these issues.
質問 # 110
A team is using Snowflake to build a supervised machine learning model for image classification. The images are stored in a Snowflake table, and the labels are in a separate table. The goal is to train a model using Snowpark Python. Which of the following code snippets represents the MOST efficient way to join the image data with its corresponding labels, pre-process the images (resize and normalize), and prepare the data for model training using Snowpark DataFrame transformations? Assume contains image data as binary, 'label df contains the image labels, and 'resize normalize udf' is a UDF that handles resizing and normalization.
- A.

- B.

- C.

- D.

- E.

正解:B、C
解説:
Options C and E represent the most efficient approaches using Snowpark DataFrames. Option C performs the join, preprocesses the images using the UDF, and selects the required columns, all within the Snowflake environment without pulling data to the client prematurely. It prepares the data for downstream tasks such as model training or saving to a new table. Option E enhances upon this by converting the Snowpark DataFrame to a Pandas DataFrame and then to NumPy arrays, which are common formats for machine learning libraries. This is a efficient way to perform complex transformations that are not readily available within the standard Snowpark API. Option A collects the entire DataFrame to the client, which is highly inefficient for large datasets. Option B uses RDDs (Resilient Distributed Datasets), which are an older Spark API and less efficient than DataFrames in Snowpark. Option D performs individual queries for each image ID, resulting in a large number of round trips to the database and is extremely inefficient. Option E also implicitly uses the power of pandas vectorized operations, leading to increased performance.
質問 # 111
You have a binary classification model deployed in Snowflake to predict customer churn. The model outputs a probability score between 0 and 1. You've calculated the following confusion matrix on a holdout set: I I Predicted Positive I Predicted Negative I --1 1 Actual Positive | 80 | 20 | I Actual Negative | 10 | 90 | What are the Precision, Recall, and Accuracy for this model, and what do these metrics tell you about the model's performance? SELECT statement given for true and false condition (True Positive, True Negative, False Positive, False Negative)
- A. Precision = 0.90, Recall = 0.80, Accuracy = 0.80. The model has good overall performance but needs to be adjusted to improve the false negative rate.
- B. Precision = 0.89, Recall = 0.80, Accuracy = 0.85. The model has good overall performance with balanced precision and recall.
- C. Precision = 0.80, Recall = 0.89, Accuracy = 0.85. The model is slightly better at identifying true positives than avoiding false positives.
- D. Precision = 0.80, Recall = 0.90, Accuracy = 0.90. The model is performing poorly, with a high rate of both false positives and false negatives.
- E. Precision = 0.89, Recall = 0.80, Accuracy = 0.85. The model is slightly better at avoiding false positives than identifying true positives.

正解:E
解説:
The correct answer is C. Precision is calculated as True Positives / (True Positives + False Positives) = 80 / (80 + 10) = 0.89. Recall is calculated as True Positives / (True Positives + False Negatives) = 80 / (80 + 20) = 0.80. Accuracy is calculated as (True Positives + True Negatives) / Total = (80 + 90) / 200 = 0.85. High precision indicates fewer false positives, while lower recall indicates more false negatives. Also the select statement calculates true positives, true negatives, false positives, and false negatives from churn_predictions table and then accuracy, precision , recall has to be calculated.
質問 # 112
You have deployed a fraud detection model in Snowflake, predicting fraudulent transactions. Initial evaluations showed high accuracy. However, after a few months, the model's performance degrades significantly. You suspect data drift and concept drift. Which of the following actions should you take FIRST to identify and address the root cause?
- A. Increase the model's prediction threshold to reduce false positives, even if it means potentially missing more fraudulent transactions.
- B. Implement a SHAP (SHapley Additive exPlanations) analysis on recent transactions to understand feature importance shifts and potential concept drift.
- C. Implement a data quality monitoring system to detect anomalies in input features, alongside calculating population stability index (PSI) to quantify data drift.
- D. Revert to a previous version of the model known to have performed well, while investigating the issue in the background.
- E. Immediately retrain the model with the latest available data, assuming data drift is the primary issue.
正解:C
解説:
Option D is the best first step. Data quality monitoring and PSI allow for quantifying and identifying data drift. SHAP (B) is useful after determining that concept drift is the problem. Retraining immediately (A) without understanding the cause can exacerbate the problem. Reverting (C) is a temporary fix, not a solution. Adjusting the threshold (E) without understanding the underlying issue is also not a proper diagnostic approach.
質問 # 113
A data scientist is analyzing website traffic data stored in Snowflake. The data includes daily page views for different pages. The data scientist suspects that the variance of page views for a particular page, 'home', has significantly increased recently. Which of the following steps and Snowflake SQL queries could be used to identify a potential change in the variance of 'home' page views over time (e.g., comparing variance before and after a specific date)? Select all that apply.
- A. Option C
- B. Option A
- C. Option B
- D. Option D
- E. Option E
正解:A、C、D、E
解説:
Options B, C, D and E are correct. Option B directly compares the variance before and after a date, allowing for a direct assessment of change. Option C uses a window function for a rolling variance calculation, revealing trends over time. Option D creates a histogram, which helps visualize the distribution and identify shifts in spread. Option E calculates standard deviation before and after a date. Option A, while calculating the overall variance, doesn't provide insight into changes over time.
質問 # 114
You are analyzing a dataset of website traffic and conversions in Snowflake, aiming to understand the relationship between the number of pages visited CPAGES VISITED) and the conversion rate (CONVERSION_RATE). You perform a simple linear regression using the 'REGR SLOPE and 'REGR INTERCEPT functions. However, after plotting the data and the regression line, you observe significant heteroscedasticity (non-constant variance of errors). Which of the following actions, performed within Snowflake during the data preparation and feature engineering phase, are MOST appropriate to address this heteroscedasticity and improve the validity of your linear regression model? (Select all that apply)
- A. Apply a logarithmic transformation to the 'CONVERSION RATE' variable using the 'LN()' function. CREATE OR REPLACE VIEW TRANSFORMED_DATA AS SELECT PAGES VISITED, LN(CONVERSION RATE) AS LOG_CONVERSION RATE FROM ORIGINAL_DATA;
- B. Apply a Box-Cox transformation to the 'CONVERSION RATE' variable. This transformation will determine the optimal lambda value using some complex SQL statistical operations. This can be approximated to log tranformation in many real life scenarios.
- C. Standardize the 'PAGES_VISITED' and 'CONVERSION_RATE variables using the and functions.Create OR REPLACE VIEW STANDARDIZED_DATA AS SELECT (PAGES_VISITED - OVER()) / OVER() AS Z PAGES_VISITED, (CONVERSION RATE -OVER()) / OVER() AS FROM ORIGINAL_DATA;
- D. Remove outlier data points from the dataset based on the Interquartile Range (IQR) of the residuals from the original linear regression model. This requires calculating the residuals first.
- E. Calculate the weighted least squares regression by weighting each observation by the inverse of the squared predicted values from an initial OLS regression. This requires multiple SQL queries.
正解:A、B
解説:
Heteroscedasticity violates one of the assumptions of linear regression, leading to unreliable standard errors and potentially biased coefficient estimates. Option A (Logarithmic Transformation): Applying a logarithmic transformation to the dependent variable ('CONVERSION_RATE) is a common technique to stabilize the variance when the variance increases with the mean. This is particularly effective when the errors are proportional to the dependent variable. Option E (Box-Cox Transformation): A Box-Cox transformation is a more general approach to transforming the dependent variable to achieve normality and homoscedasticity. It estimates a parameter (lambda) that determines the optimal transformation. Log transformation is a special case of box cox transformation, where lambda = O. Option B describes weighted least squares regression, but directly implementing this within Snowflake SQL efficiently, including calculating the initial OLS regression and subsequent weights, would be complex and may not be practically feasible without Snowpark/Python integration. It's theoretically correct but challenging to implement in pure SQL. Option C, Standardization, addresses multicollinearity issues (if present) but doesn't directly tackle heteroscedasticity. It scales the variables but doesn't change the relationship between the mean and variance of the errors. Option D, outlier removal, can be a valid step in data preparation, but it's not a direct solution to heteroscedasticity. It might help reduce the impact of outliers on the model, but it doesn't address the underlying pattern of non-constant variance. Outlier treatment requires calculation of residuals first, which is not always easy, and may cause data loss, but it might indirectly reduce heteroscedasticity.
質問 # 115
A marketing team uses Snowflake to store customer purchase data'. They want to segment customers based on their spending habits using a derived feature called The 'PURCHASES' table has columns 'customer id' (IN T), 'purchase_date' (DATE), and 'purchase_amount' (NUMBER). The team needs a way to handle situations where a customer might have missing months (no purchases in a particular month). They want to impute a 0 spend for those months before calculating the average. Which approach provides the most accurate and robust calculation, especially when considering users with sparse purchase history?
- A. Create a view containing all months for each customer, left join with the 'PURCHASES' table, impute 0 for null 'purchase_amounts values, and then calculate the average spend. Requires creating a helper table for all the month.
- B. Calculate the total spend for each customer and divide by the number of months since their first purchase: / DATEDlFF(month, CURRENT DATE()) GROUP BY customer_id'.
- C. Use a window function to calculate the average spend over a fixed window of the last 3 months, ignoring missing months in the calculation.
- D. Calculate the average monthly spend directly from the 'PURCHASES' table without accounting for missing months: 'AVG(purchase_amount) GROUP BY customer_id, date_trunc('month',
- E. Calculate the average spend only for customers with purchases in every month of the year. Ignore other customers in the analysis.
正解:A
解説:
Option B provides the most accurate and robust solution. By creating a view with all months for each customer and joining with the "PURCHASES' table, you can explicitly account for missing months by imputing 0 spend. This ensures that the average spend calculation is not biased by only considering months with purchases. Option A will underestimate the average spend for customers with missing months. Option C focuses only on recent months and doesn't address the issue of imputing 0 for missing data, potentially creating bias. Option D divides by the total number of months since the first purchase, but doesn't explicitly account for missing months with 0 spend. Option E biases your data by only looking at full year users.
質問 # 116
You are developing a regression model in Snowflake using Snowpark to predict house prices based on features like square footage, number of bedrooms, and location. After training the model, you need to evaluate its performance. Which of the following Snowflake SQL queries, used in conjunction with the model's predictions stored in a table named 'PREDICTED PRICES, would be the most efficient way to calculate the Root Mean Squared Error (RMSE) using Snowflake's built-in functions, given that the actual prices are stored in the 'ACTUAL PRICES' table?
- A. Option A
- B. Option C
- C. Option D
- D. Option B
- E. Option E
正解:C
解説:
Option D is the most efficient and correct way to calculate RMSE. RMSE is the square root of the average of the squared differences between predicted and actual values. - p.predicted_price), 2)' calculates the squared difference. calculates the average of these squared differences. calculates the square root of the average, resulting in the RMSE. Option A is less efficient because it requires creating a temporary table. Option B and E are incorrect since they uses 'MEAN' which is unavailable in Snowflake and Exp/ln will return geometic mean instead of RMSE. Option C calculates the standard deviation of the differences, not the RMSE.
質問 # 117
A retail company is using Snowflake to store sales data'. They have a table called 'SALES DATA' with columns: 'SALE ID', 'PRODUCT D', 'SALE DATE', 'QUANTITY' , and 'PRICE'. The data scientist wants to analyze the trend of daily sales over the last year and visualize this trend in Snowsight to present to the business team. Which of the following approaches, using Snowsight and SQL, would be the most efficient and appropriate for visualizing the daily sales trend?
- A. Export all the data from the 'SALES DATA' table to a CSV file and use an external tool like Python's Matplotlib or Tableau to create the visualization.
- B. Write a SQL query that uses 'DATE TRUNC('day', SALE DATE)' to group sales by day and calculate the total sales (SUM(QUANTITY PRICE)). Use Snowsight's line chart option with the truncated date on the x-axis and total sales on the y-axis, filtering by 'SALE_DATE' within the last year. Furthermore, use moving average with window function to smooth the data.
- C. Write a SQL query that calculates the daily total sales amount CSUM(QUANTITY PRICEY) for the last year and use Snowsight's charting options to generate a line chart with 'SALE DATE on the x-axis and daily sales amount on the y-axis.
- D. Create a Snowflake view that aggregates the daily sales data, then use Snowsight to visualize the view data as a table without any chart.
- E. Use the Snowsight web UI to manually filter the 'SALES_DATX table by 'SALE_DATE for the last year and create a bar chart showing 'SALE_ID count per day.
正解:B
解説:
Option E provides the most efficient and appropriate solution. It uses SQL to aggregate the data by day using DATE TRUNC and calculates the total sales amount, addressing the data preparation part. Snowsight can then be used to generate a line chart, making it easy to visualize the trend over time. The usage of moving average via window functions add a layer to smooth the data so that the outliers can be removed. Other options are less efficient (exporting data to external tools) or don't directly address the visualization of trends (showing raw data in a table or manually filtering data).
質問 # 118
Which of the following statements are TRUE regarding the 'Data Understanding' and 'Data Preparation' steps within the Machine Learning lifecycle, specifically concerning handling data directly within Snowflake for a large, complex dataset?
- A. The 'Data Understanding' step is unnecessary when working with data stored in Snowflake because Snowflake automatically validates and cleans the data during ingestion.
- B. Data Preparation should always be performed outside of Snowflake using external tools to avoid impacting Snowflake performance.
- C. Data Understanding primarily involves identifying potential data quality issues like missing values, outliers, and inconsistencies, and Snowflake features like 'QUALIFY and 'APPROX TOP can aid in this process.
- D. During Data Preparation, you should always prioritize creating a single, wide table containing all possible features to simplify the modeling process.
- E. Data Preparation in Snowflake can involve feature engineering using SQL functions, creating aggregated features with window functions, and handling missing values using 'NVL' or 'COALESCE. Furthermore, Snowpark Python provides richer data manipulation using DataFrame APIs directly on Snowflake data.
正解:C、E
解説:
Data Understanding is crucial for identifying data quality issues using tools such as 'QUALIFY' and 'APPROX TOP Data Preparation within Snowflake using SQL and Snowpark Python enables efficient feature engineering and data cleaning. Option C is incorrect because Snowflake doesn't automatically validate and clean your data. Option D is incorrect as leveraging Snowflake's compute for data preparation alongside Snowpark can drastically increase speed. Option E is not desirable, feature selection is important, and feature stores help in organization.
質問 # 119
You have trained a complex machine learning model using Snowpark for Python and are now preparing it for production deployment using Snowpark Container Services. You have containerized the model and pushed it to a Snowflake-managed registry. However, you need to ensure that only authorized users can access and deploy this model. Which of the following actions MUST you take to secure your model in the Snowflake Model Registry, ensuring appropriate access control, and minimizing the risk of unauthorized deployment or modification?
- A. Create a custom role, grant the USAGE' privilege on the database and schema containing the model registry, grant the 'READ privilege on the registry, and then grant this custom role to only those users authorized to deploy the model. Consider masking sensitive model parameters using masking policies.
- B. Store the model outside of Snowflake managed registry and use external authentication to control access.
- C. Grant the 'USAGE privilege on the stage where the model files are stored to all users who need to deploy the model.
- D. Grant the 'READ privilege on the container registry to all users who need to deploy the model. Create a custom role with the 'APPLY MASKING POLICY privilege and grant this role to the deployment team.
- E. Grant the 'USAGE privilege on the database and schema containing the model registry, grant the 'READ privilege on the registry itself, and grant the EXECUTE TASK' privilege to the deployment team for the deployment task.
正解:A
解説:
Option D is the correct answer because it provides the most secure and granular access control. 'USAGE on the database and schema allows access to the container registry. 'READ on the registry allows viewing of model metadata without modification. Creating a custom role and granting it to specific users limits access to only authorized personnel. Utilizing masking policies further secures sensitive parameters. Option A is incorrect because it does not control access to the registry itself. 'USAGE privilege on a stage alone is insufficient for managing model registry access. Option B is incorrect because 'APPLY MASKING POLICY is not relevant for controlling access to the model registry. Option C is partially correct, but 'EXECUTE TASK' grants unnecessary privileges related to task execution, which is beyond the scope of registry access. It also lacks fine-grained control over who can deploy. Option E is incorrect because while it offers security, it bypasses the advantages of using Snowflake's managed registry.
質問 # 120
You are working with a Snowflake table named 'CUSTOMER DATA' that contains personally identifiable information (PII), including customer names, email addresses, and phone numbers. Your team needs to perform exploratory data analysis on this data to understand customer demographics and behavior. However, you must ensure that the PII is protected and that only authorized personnel can access the sensitive information. Which of the following strategies should you implement in Snowflake to achieve secure EDA?
- A. Create a view on top of that excludes the PII columns (e.g., name, email, phone). Grant 'SELECT privileges on this view to data scientists. Also implement data masking policies on the 'CUSTOMER DATA' table for the PII columns and grant 'SELECT on the table to specific roles requiring access to the masked values.
- B. Apply dynamic data masking to the entire 'CUSTOMER_DATA' table, masking all columns by default, and provide decryption keys only to authorized users.
- C. Use transient tables to store the customer data after PII is obfuscated, drop the table and reload new data daily.
- D. Grant 'SELECT privileges on the 'CUSTOMER DATA' table to all data scientists, and rely on them to avoid querying PII columns directly.
- E. Create a copy of the 'CUSTOMER DATA table without the PII columns and grant 'SELECT' privileges on this copy to the data scientists. Use masking policies on the original table.
正解:A、E
解説:
Options B and E are both valid strategies. Option B provides a view with non-PII data, while using masking policies on the table. Option E creates a copy of the 'CUSTOMER_DATR table and leverages masking on original table. Option A is insecure. Option C while obfuscating the PII, will lead to data loss and will be costly to move the data. Option D isn't practical, it would overly restrict access.
質問 # 121
You are building a machine learning model to predict loan defaults. You have a dataset in Snowflake with the following features: 'income' (annual income in USD), 'loan_amount' (loan amount in USD), and 'credit_score' (FICO score). You need to normalize these features before training your model. The data has outliers in both 'income' and 'loan_amount', and 'credit_score' has a roughly normal distribution but you still want to standardize it to have a mean of 0 and standard deviation of 1. You want to perform these normalizations using only SQL in Snowflake (no UDFs). Which of the following SQL transformations are most suitable?
- A. Option C
- B. Option A
- C. Option D
- D. Option B
- E. Option E
正解:A
解説:
Option C is the most suitable. Robust Scaling is appropriate for 'income' and 'loan_amount' due to the presence of outliers. Robust scaling, using IQR is less sensitive to extreme values than Min-Max or Z-score. Z-score standardization is suitable for 'credit_score' as it has a roughly normal distribution, and standardization is desired. Option A is incorrect since Min-Max scaling is highly sensitive to outliers. Option B is incorrect because Z-score is not outlier resilient and it doesn't take into account the data properties given for credit score. Log transformation and arcsinh transform can handle outliers, they're not as resilient as robust scaling. The arcsinh transformation is also useful for features that may have negative values, but we don't have that information here.
質問 # 122
You are working with a Snowflake table 'CUSTOMER DATA containing customer information for a marketing campaign. The table includes columns like 'CUSTOMER ID', 'FIRST NAME', 'LAST NAME, 'EMAIL', 'PHONE NUMBER, 'ADDRESS, 'CITY, 'STATE, ZIP CODE, 'COUNTRY, 'PURCHASE HISTORY, 'CLICKSTREAM DATA, and 'OBSOLETE COLUMN'. You need to prepare this data for a machine learning model focused on predicting customer churn. Which of the following strategies and Snowpark Python code snippets would be MOST efficient and appropriate for removing irrelevant fields and handling potentially sensitive personal information while adhering to data governance policies? Assume data governance requires removing personally identifiable information (PII) that isn't strictly necessary for the churn model.
- A. Dropping 'FIRST NAME, UST NAME, 'EMAIL', 'PHONE NUMBER, 'ADDRESS', 'CITY, 'STATE', ZIP CODE, 'COUNTRY and 'OBSOLETE_COLUMN' columns directly using 'LAST_NAME', 'EMAIL', 'PHONE_NUMBER', 'ADDRESS', 'CITY', 'STATE', 'ZIP_CODE', 'COUNTRY', without any further consideration.
- B. Dropping columns 'OBSOLETE_COLUMN' directly. Then, for PII columns ('FIRST_NAME, 'LAST_NAME, 'EMAIL', 'PHONE_NUMBER, 'ADDRESS', 'CITY', 'STATE' , , 'COUNTRY), create a separate table with anonymized or aggregated data for analysis unrelated to the churn model. Use Keep all PII columns but encrypt them using Snowflake's built-in encryption features to comply with data governance before building the model. Drop 'OBSOLETE COLUMN'.
- C. Keeping all columns as is and providing access to Data Scientists without any changes, relying on role based security access controls only.
- D. Drop 'OBSOLETE_COLUMN'. For columns like and 'LAST_NAME' , consider aggregating into a single 'FULL_NAME feature if needed for some downstream task. Apply hashing or tokenization techniques to sensitive PII columns like and 'PHONE NUMBER using Snowpark UDFs, depending on the model's requirements. Drop columns like 'ADDRESS, 'CITY, 'STATE, ZIP_CODE, 'COUNTRY as they likely do not contribute to churn prediction. Example hashing function:

正解:C
解説:
Option D is the most comprehensive and adheres to best practices. It identifies and removes truly irrelevant columns ('OBSOLETE_COLUMN', and location details), handles PII appropriately using hashing and tokenization (or aggregation), and leverages Snowpark UDFs for custom data transformations. Options A is too simplistic and doesn't consider data governance. Option B is better than A, but more complex than needed if the data is not needed elsewhere. Option C doesn't address the principle of minimizing data exposure. Option E is unacceptable from a data governance and security perspective. The example code demonstrates how to register a UDF for hashing email addresses.
質問 # 123
You've developed a fraud detection model using Snowflake ML and want to estimate the expected payout (loss or gain) based on the model's predictions. The cost of investigating a potentially fraudulent transaction is $50. If a fraudulent transaction goes undetected, the average loss is $1000. The model's confusion matrix on a validation dataset is: Predicted Fraud Predicted Not Fraud Actual Fraud 150 50 Actual Not Fraud 20 780 Which of the following SQL queries in Snowflake, assuming you have a table 'FRAUD PREDICTIONS' with columns 'TRANSACTION ID', 'ACTUAL FRAUD', and 'PREDICTED FRAUD' (1 for Fraud, O for Not Fraud), provides the most accurate estimate of the expected payout for every 1000 transactions?
- A. Option A
- B. Option C
- C. Option D
- D. Option B
- E. Option E
正解:E
解説:
Option E correctly calculates the expected payout by subtracting the cost of false positives (investigating non-fraudulent transactions) from the loss due to false negatives (undetected fraudulent transactions). The confusion matrix data (50 false negatives, 20 false positives) translates to an expected payout of (1000 50) - (50 20) = $49000 loss for every 1000 transactions. The other queries either incorrectly combine the costs and losses, or only calculate one aspect. The other query calculate in correct format or not relevant as per context.
質問 # 124
You are performing exploratory data analysis on a dataset of customer transactions in Snowflake to prepare for a linear regression model that predicts transaction value based on several customer-related features (e.g., age, location, number of previous transactions). You suspect a non-linear relationship between 'customer_age' and 'transaction_value'. Which of the following Snowflake SQL techniques is MOST appropriate for exploring and potentially transforming the 'customer_age' variable to better fit a linear regression model?
- A. Use the window function to bin 'customer_age' into quartiles and treat each quartile as a categorical variable in the linear regression model.
- B. Implement a Box-Cox transformation in Snowpark Python, select a suitable transformation parameter based on the data, and apply the transformation on 'customer_age' feature.
- C. Calculate the Pearson correlation coefficient between 'customer_age' and 'transaction_value' using the function. If the correlation is low, discard the 'customer_age' variable.
- D. Apply a logarithmic transformation to 'customer_age' if a scatter plot of 'customer_age' vs 'transaction_value' shows a curve that flattens out as 'customer_age' increases.
- E. Create polynomial features by adding 'customer_ageA2' and 'customer_ageA3' as new columns to the table, without checking for interaction effects.
正解:D
解説:
Logarithmic transformation is a suitable method when the relationship flattens as the value increases. Creating polynomial features blindly without checking for interaction effects is generally not a good practice. Binning 'customer_age' into quartiles is also a potential solution, it discretizes the continuous data and might lose information, also it's only suitable after confirming its the best option available. A low correlation does not necessarily mean the variable should be discarded; it could indicate a non-linear relationship that a linear model cannot capture directly. Box-Cox transformation is a good approach but may overcomplicate the task. Since Box-Cox transformations are generally harder than Log transformations.
質問 # 125
A data scientist needs to analyze website session data stored in a Snowflake table named 'WEB SESSIONS'. The table contains columns like 'SESSION D', 'USER_ID, 'PAGE_VIEWS', 'TIME SPENT_SECONDS', and 'TIMESTAMP. They want to identify potential bot traffic by analyzing the correlation between 'PAGE VIEWS' and 'TIME SPENT SECONDS'. Which of the following Snowflake SQL queries is the MOST efficient and statistically sound way to calculate the Pearson correlation coefficient between these two columns, handling potential NULL values appropriately?
- A. Option A
- B. Option C
- C. Option D
- D. Option B
- E. Option E
正解:C
解説:
The 'CORR function in Snowflake directly calculates the Pearson correlation coefficient and implicitly handles NULL values by excluding rows where either input is NULL. Option A is incorrect because it does not explicitly filter NULL values, though the 'CORR' function itself handles it, Option B is mathematically correct but less concise. Option C uses 'APPROX CORR, which is useful for large datasets where approximate results are acceptable, but for a general scenario without size constraints, 'CORR is preferred for accuracy. While Option E correctly calculates the correlation coefficient using covariance and standard deviation, it uses approximation functions which may impact accuracy without a necessary tradeoff.
質問 # 126
You are a data scientist working for an e-commerce company. You have a table named 'sales_data' with columns 'product_id' , customer_id' , 'transaction_date' , and 'sale_amount'. You need to identify the top 5 products by total sale amount for each month. Which of the following Snowflake SQL queries is the MOST efficient and correct way to achieve this, while also handling potential ties in sale amounts?
- A.

- B.

- C.

- D.

- E.

正解:B、C
解説:
Options C and E are correct. Both use a subquery to calculate the rank of each product within each month's sales, then filter for the top 5 products. The main difference is that option C uses DENSE_RANK(), which assigns consecutive ranks even if there are ties in sales amount (resulting in more than 5 products being selected if there are ties for the 5th position), while option E uses RANK(), which assigns the same rank to tied values but can skip ranks. Option A is incorrect because it attempts to filter using HAVING on a ranking calculated within the same query level, which is not allowed in many SQL implementations (and can be logically incorrect). Options B and D are incorrect as they employ ROW_NUMBER() and NTILE(5) respectively. ROW_NUMBER will not handle ties correctly, while NTILE just divides the data into 5 groups without explicitly identifying the 'top' 5. Option A uses a rank function inside the HAVING clause which is often syntactically invalid.
質問 # 127
A retail company, 'GlobalMart,' wants to optimize its product placement strategy in its physical stores. They have transactional data stored in Snowflake, capturing which items are purchased together in the same transaction. They aim to use association rule mining to identify frequently co-occurring items. Given the following simplified transactional data in a Snowflake table named 'SALES TRANSACTIONS:
Which of the following SQL-based approaches, combined with Snowpark Python for association rule generation (using a library like 'mlxtend'), would be the MOST efficient and scalable way to prepare this data for association rule mining, specifically focusing on converting it into a transaction-item matrix suitable for algorithms like Apriori? Assume 'spark' is a 'snowpark.Session' object connected to your Snowflake environment.
- A. Utilizing Snowflake's SQL function within a stored procedure to concatenate items purchased in each transaction into a string, then processing the string using Python in Snowpark to create the transaction-item matrix. This approach minimizes data transfer but introduces string parsing overhead in Python.
- B. First extracting all the data from snowflake into pandas dataframe and then use pivoting and other pandas operations to convert to the needed format.
- C. Using Snowpark's 'DataFrame.groupBy(V and functions to aggregate items by transaction ID, then pivoting the data using to create the transaction-item matrix. This approach requires loading all data into the Snowpark DataFrame before pivoting.
- D. Creating a temporary table in Snowflake using a SQL query that aggregates items by transaction and represents them in a format suitable for Snowpark's 'mlxtend' library. Then load this temporary table into a Snowpark DataFrame and use it as input to the Apriori algorithm.
- E. Employing a custom UDF (User-Defined Function) written in Java or Scala that directly processes the transactional data within Snowflake and outputs the transaction-item matrix in a format suitable for Snowpark. This offloads processing to compiled code within Snowflake, maximizing performance.
正解:C
解説:
Option A is the most efficient and scalable approach because Snowpark DataFrames are designed to handle large datasets efficiently within the Snowflake environment. Using 'groupBy(V, "agg()", and 'pivot()' allows Snowflake's engine to perform the data transformation in parallel and at scale. While option B avoids loading all the data, the string parsing in Python introduces overhead and potential scalability issues. Option C, while potentially performant, adds complexity to the solution. Option D can be a viable interim step, but performing the pivoting and aggregation directly within the Snowpark DataFrame is generally more streamlined. Option E is not efficient because it loads the data into pandas which is not scalable for big datasets.
質問 # 128
......
Snowflake DSA-C03試験問題集で[2025年最新] 練習有効な試験問題集解答:https://jp.fast2test.com/DSA-C03-premium-file.html
DSA-C03問題集を掴み取れ![最新2025]Snowflake試験が合格できます:https://drive.google.com/open?id=1XsmmLB98GCy7n0jPHD-cHPwOWNzfcs_u