0
0
Prompt Engineering / GenAIml~20 mins

Generative vs discriminative models in Prompt Engineering / GenAI - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Generative vs Discriminative Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding model types: Generative vs Discriminative

Which statement correctly describes the main difference between generative and discriminative models?

AGenerative models only classify data, whereas discriminative models generate new data samples.
BDiscriminative models learn the joint probability of data and labels, while generative models learn the conditional probability of labels given data.
CGenerative models learn the joint probability of data and labels, while discriminative models learn the conditional probability of labels given data.
DGenerative models always perform better than discriminative models on classification tasks.
Attempts:
2 left
💡 Hint

Think about what each model tries to understand about the data and labels.

Model Choice
intermediate
1:30remaining
Choosing the right model for generating images

You want to create a model that can generate realistic images of cats. Which type of model should you choose?

ADiscriminative model like decision trees
BDiscriminative model like logistic regression
CDiscriminative model like Support Vector Machine (SVM)
DGenerative model like a Variational Autoencoder (VAE)
Attempts:
2 left
💡 Hint

Think about which model type can create new data samples.

Metrics
advanced
1:30remaining
Evaluating generative model quality

Which metric is commonly used to evaluate the quality of images generated by a generative model?

AAccuracy
BInception Score (IS)
CMean Squared Error (MSE)
DPrecision
Attempts:
2 left
💡 Hint

Consider metrics designed specifically for generated images.

🔧 Debug
advanced
2:00remaining
Debugging a discriminative model training issue

Given this code snippet training a discriminative model, what is the likely cause of the error?

model = LogisticRegression()
model.fit(X_train, y_train)
preds = model.predict(X_test)
print(f"Accuracy: {accuracy_score(y_test, preds)}")

Error message: ValueError: Found input variables with inconsistent numbers of samples

AX_train and y_train have different numbers of samples
BThe model is not suitable for classification
Caccuracy_score is not imported
DX_test contains missing values
Attempts:
2 left
💡 Hint

Check the shapes of training data and labels.

Predict Output
expert
2:00remaining
Output of a simple generative model code

What is the output of this Python code simulating a simple generative model sampling from a Gaussian distribution?

import numpy as np
np.random.seed(42)
mean = 0
std_dev = 1
samples = np.random.normal(mean, std_dev, 3)
print([round(s, 2) for s in samples])
A[0.5, -0.14, 0.65]
B[0.5, -0.14, 0.45]
C[0.5, -0.14, 0.54]
D[0.5, -0.15, 0.65]
Attempts:
2 left
💡 Hint

Run the code or recall numpy's normal distribution output with seed 42.