What is the main purpose of ML model training in Snowflake?
To create a machine learning model directly inside Snowflake by using SQL commands, without moving data outside the platform.
Click to reveal answer
beginner
Which Snowflake SQL command is used to create and train a machine learning model?
The CREATE MODEL command is used to define and train a machine learning model inside Snowflake.
Click to reveal answer
intermediate
What types of machine learning models can you train in Snowflake using SQL?
You can train models like linear regression, logistic regression, decision trees, and random forests using Snowflake's built-in ML capabilities.
Click to reveal answer
intermediate
How do you evaluate the performance of a trained model in Snowflake?
You use the MODEL_EVALUATE function to get metrics like accuracy, precision, recall, or RMSE depending on the model type.
Click to reveal answer
beginner
Why is training ML models inside Snowflake beneficial compared to exporting data to external tools?
It saves time and resources by avoiding data movement, keeps data secure inside Snowflake, and leverages Snowflake's scalable compute power.
Click to reveal answer
Which SQL command starts the process of training a machine learning model in Snowflake?
ATRAIN MODEL
BBUILD MODEL
CCREATE MODEL
DSTART MODEL
✗ Incorrect
The CREATE MODEL command is used in Snowflake to define and train a machine learning model.
What is a key advantage of training ML models inside Snowflake?
ARuns only on small datasets
BRequires less data for training
CAutomatically creates dashboards
DNo need to move data outside Snowflake
✗ Incorrect
Training inside Snowflake avoids data movement, improving security and efficiency.
Which function helps you check how well your model performs in Snowflake?
AMODEL_SCORE
BMODEL_EVALUATE
CMODEL_CHECK
DMODEL_TEST
✗ Incorrect
The MODEL_EVALUATE function returns performance metrics for your trained model.
Which of these is NOT a model type you can train directly in Snowflake?
ANeural Networks
BLogistic Regression
CDecision Trees
DLinear Regression
✗ Incorrect
Snowflake currently supports models like linear and logistic regression and decision trees, but not neural networks.
What language do you use to train ML models in Snowflake?
ASQL
BPython
CJava
DR
✗ Incorrect
Snowflake uses SQL commands to create and train ML models inside the platform.
Explain the process of training a machine learning model inside Snowflake using SQL.
Think about how you tell Snowflake what model to build and how to check if it works well.
You got /4 concepts.
Describe the benefits of training ML models directly inside Snowflake compared to exporting data to external tools.
Consider time, security, and ease of use.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of the CREATE MODEL statement in Snowflake's ML feature?
easy
A. To delete an existing machine learning model
B. To export model results to an external file
C. To make predictions using a trained model
D. To define and train a machine learning model using SQL
Solution
Step 1: Understand the role of CREATE MODEL
This statement is used to define the model type, label column, and features, which means it sets up and trains the model.
Step 2: Differentiate from other commands
PREDICT is used for predictions, not CREATE MODEL. Deleting or exporting models uses other commands.
Final Answer:
To define and train a machine learning model using SQL -> Option D
Quick Check:
CREATE MODEL = train model [OK]
Hint: Remember: CREATE MODEL means build and train [OK]
Common Mistakes:
Confusing CREATE MODEL with PREDICT
Thinking CREATE MODEL deletes models
Assuming CREATE MODEL exports data
2. Which of the following is the correct syntax to create a logistic regression model named my_model in Snowflake?
easy
A. CREATE MODEL my_model AS logistic_regression WITH LABEL target AND FEATURES age, income;
B. CREATE MODEL my_model TYPE = 'logistic_regression' LABEL = target FEATURES = (age, income);
C. CREATE MODEL my_model USING logistic_regression LABEL target FEATURES (age, income);
D. CREATE MODEL my_model TYPE logistic_regression LABEL target FEATURES (age, income);
Solution
Step 1: Recall Snowflake's CREATE MODEL syntax
The correct syntax uses TYPE = 'model_type', LABEL = label_column, and FEATURES = (feature_list) with equal signs and parentheses.
Step 2: Compare options
CREATE MODEL my_model TYPE = 'logistic_regression' LABEL = target FEATURES = (age, income); matches the correct syntax exactly. Others have wrong keywords or missing equal signs or parentheses.
Final Answer:
CREATE MODEL my_model TYPE = 'logistic_regression' LABEL = target FEATURES = (age, income); -> Option B
Quick Check:
Correct syntax uses TYPE =, LABEL =, FEATURES = ( ) [OK]
Hint: Look for equal signs and parentheses in syntax [OK]
Common Mistakes:
Omitting equal signs (=) in parameters
Missing parentheses around features
Using wrong keywords like AS or WITH
3. Given the following Snowflake SQL code:
CREATE MODEL churn_model TYPE = 'random_forest' LABEL = churn FEATURES = (age, balance, transactions); SELECT * FROM PREDICT(churn_model, (SELECT age, balance, transactions FROM customers_test));
What will be the output of the PREDICT statement?
medium
A. The original customers_test table without predictions
B. An error because PREDICT cannot use SELECT statements
C. A table with predicted churn values for each row in customers_test
D. A summary report of model accuracy
Solution
Step 1: Understand the PREDICT statement
PREDICT applies the trained model to new data and returns predicted values for each input row.
Step 2: Analyze the code
The SELECT statement provides features from customers_test. PREDICT will output predictions for each row based on these features.
Final Answer:
A table with predicted churn values for each row in customers_test -> Option C
Quick Check:
PREDICT outputs predictions per input row [OK]
Hint: PREDICT returns predictions for each input row [OK]
Common Mistakes:
Thinking PREDICT returns original data only
Assuming PREDICT gives accuracy metrics
Believing PREDICT cannot use SELECT
4. You run this Snowflake command:
CREATE MODEL sales_model TYPE = 'linear_regression' LABEL = sales_amount FEATURES = (store_size, location);
But get an error saying "Invalid feature column: location". What is the most likely cause?
medium
A. The column 'location' is not numeric or not suitable as a feature
B. The LABEL column 'sales_amount' does not exist
C. The model type 'linear_regression' is not supported
D. The FEATURES list must be empty for linear regression
Solution
Step 1: Understand feature requirements
Features must be numeric or convertible to numeric for linear regression models.
Step 2: Analyze the error message
"Invalid feature column" suggests 'location' is likely categorical or text, which linear regression cannot use directly.
Final Answer:
The column 'location' is not numeric or not suitable as a feature -> Option A
Quick Check:
Features must be numeric for linear regression [OK]
Hint: Check feature columns are numeric for regression models [OK]
Common Mistakes:
Assuming LABEL column causes this error
Thinking model type is unsupported
Believing features list can be empty
5. You want to train a classification model in Snowflake to predict customer churn. You have a dataset with columns: customer_id, age, monthly_spend, churned (1 if churned, 0 otherwise), and signup_date. Which CREATE MODEL statement correctly trains a model ignoring customer_id and signup_date?
hard
A. CREATE MODEL churn_model TYPE = 'logistic_regression' LABEL = churned FEATURES = (age, monthly_spend);
B. CREATE MODEL churn_model TYPE = 'logistic_regression' LABEL = customer_id FEATURES = (age, monthly_spend, churned);
C. CREATE MODEL churn_model TYPE = 'logistic_regression' LABEL = churned FEATURES = (customer_id, age, monthly_spend, signup_date);
D. CREATE MODEL churn_model TYPE = 'linear_regression' LABEL = churned FEATURES = (age, monthly_spend);
Solution
Step 1: Identify correct label and features
The label is churned because it indicates churn. Features should exclude customer_id and signup_date as they are identifiers or dates not useful for prediction.
Step 2: Choose appropriate model type
Since churn is a binary outcome, logistic regression is suitable, not linear regression.
Final Answer:
CREATE MODEL churn_model TYPE = 'logistic_regression' LABEL = churned FEATURES = (age, monthly_spend); -> Option A
Quick Check:
Label = churned, features exclude IDs/dates, logistic regression for classification [OK]
Hint: Use label as target, exclude IDs/dates from features [OK]
Common Mistakes:
Using ID or date columns as features
Choosing wrong label column
Using linear regression for classification
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.