0
0
Prompt Engineering / GenAIml~10 mins

Benchmark datasets in Prompt Engineering / GenAI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load the popular MNIST dataset using TensorFlow.

Prompt Engineering / GenAI
import tensorflow as tf
mnist = tf.keras.datasets.[1].load_data()
Drag options to blanks, or click blank then click option'
Afashion_mnist
Bcifar10
Cimagenet
Dmnist
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cifar10' instead of 'mnist' will load a different dataset.
Using 'imagenet' requires different loading methods.
2fill in blank
medium

Complete the code to split the dataset into training and testing sets using scikit-learn.

Prompt Engineering / GenAI
from sklearn.model_selection import [1]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
Drag options to blanks, or click blank then click option'
Atrain_test_split
Bcross_val_score
CGridSearchCV
DKFold
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cross_val_score' does not split data but evaluates models.
Using 'GridSearchCV' is for hyperparameter tuning.
3fill in blank
hard

Fix the error in the code to load the CIFAR-10 dataset correctly using PyTorch.

Prompt Engineering / GenAI
import torchvision.datasets as datasets
cifar10 = datasets.CIFAR10(root='./data', train=True, download=True, transform=[1])
Drag options to blanks, or click blank then click option'
ANone
Btransforms.ToTensor()
Ctorch.Tensor
Dtransform.ToTensor()
Attempts:
3 left
💡 Hint
Common Mistakes
Passing None disables transformations and causes errors later.
Using 'transform.ToTensor()' is incorrect syntax.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps dataset names to their sample counts.

Prompt Engineering / GenAI
dataset_sizes = {name: len([1]) for name, [2] in datasets.items()}
Drag options to blanks, or click blank then click option'
Adata
Bdataset
Cvalue
Dsample
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'dataset' or 'sample' as variable names that don't match the iteration.
5fill in blank
hard

Fill all three blanks to filter datasets with more than 10,000 samples and create a new dictionary.

Prompt Engineering / GenAI
large_datasets = {name: [1] for name, [2] in datasets.items() if len([3]) > 10000}
Drag options to blanks, or click blank then click option'
Avalue
Bdata
Ddataset
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names inconsistently causes errors.
Using the wrong variable in the length check.