1/47
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What is the shape of a batch of 50 RGB images of size 64×64?
a) [50, 64, 64, 3] b) [50, 64, 64, 1] c) [64, 64, 3] d) [50, 64, 64]
a
Complete the code so a rank-1 tensor is created: tf.\_\_\_\_([10, 20, 30]).print();
a) tensor2d b) tensor1d c) tensor3d d) tensor
b
What is the shape of the tensor created by tf.tensor2d([[1,2,3],[4,5,6]])?
a) [6] b) [3,2] c) [2,3] d) [2,2]
c
Complete the code so a 3×3 tensor of zeros is created: tf.\_\_\_\_([3,3]).print();
a) ones b) empty c) fill d) zeros
d
What does the line b.div(b.max()) accomplish, in one word?
a) Normalization b) Scaling c) Encoding d) Shuffling
a
What is the result of a.add(b) where a = tf.tensor1d([1,2,3]) and b = tf.tensor1d([10,20,30])?
a) [1,2,3] b) [11,22,33] c) [10,20,30] d) [5,10,15]
b
What is the result of a.mul(5) where a = tf.tensor1d([1,2,3])?
a) [11,22,33] b) [10,20,30] c) [5,10,15] d) [1,2,3]
c
What does tf.tidy() do?
a) Shuffles tensors b) Trains a model c) Encodes categories d) Automatically disposes tensors created inside the callback
d
Complete the code so features and labels are shuffled together: tf.util.\_\_\_\_(xsRaw, ysRaw);
a) shuffleCombo b) shuffle c) shuffleBoth d) mix
a
Why is shuffling before splitting essential for the Iris dataset?
a) It reduces file size b) The file is sorted by species, so without shuffling the test set would be 100% virginica c) It increases the number of features d) It converts labels to one-hot
b
Complete the code so the fetched iris.json is parsed into an object: const data = await (await fetch('iris.json')).\_\_\_\_();
a) text() b) parse() c) json() d) data()
c
What is the shape of the ys tensor after tf.tensor2d(ysRaw) in Activity 2, where ysRaw has 150 one-hot labels for 3 species?
a) [150, 4] b) [150, 1] c) [3, 150] d) [150, 3]
d
Complete the normalization so the tensor is scaled to 0–1: xs.sub(min).div(max.\_\_\_\_(min));
a) sub b) div c) add d) mul
a
What does xs.min(0) return in Activity 2?
a) The global minimum of all values b) The per-column minimum c) The first element d) The index of the minimum
b
Complete the code so the split index is an integer: const split = Math.\_\_\_\_(150 * 0.8);
a) round b) ceil c) floor d) trunc
c
What is the expected shape of trainXs after the 80/20 split in Activity 2?
a) [30, 4] b) [150, 4] c) [4, 120] d) [120, 4]
d
Complete the code so the tensor is split into two equal halves: const [trainXs, testXs] = tf.\_\_\_\_(xsNorm, [split, 150 - split]);
a) split b) cut c) partition d) divide
a
Which activation function is used in the final layer of the Iris multi-class classifier?
a) relu b) softmax c) sigmoid d) tanh
b
Which loss function is used to compile the Iris multi-class classifier?
a) binaryCrossentropy b) meanSquaredError c) categoricalCrossentropy d) hinge
c
Complete the compile call so accuracy is tracked: model.compile({ optimizer: 'adam', loss: 'categoricalCrossentropy', metrics: ['\_\_\_\_'] });
a) score b) precision c) loss d) accuracy
d
What does tfvis.show.fitCallbacks provide during training?
a) Live loss/accuracy curves drawn in the visor b) A model summary c) A scatterplot of the data d) A saved copy of the model
a
Complete the fit call so 20% of training data is reserved for validation: await model.fit(trainXs, trainYs, { epochs: 60, batchSize: 16, \_\_\_\_: 0.2, ... });
a) testSplit b) validationSplit c) holdout d) trainSplit
b
Complete the code so the model is evaluated on the held-out test set: const [testLoss, testAcc] = model.\_\_\_\_(testXs, testYs);
a) fit b) predict c) evaluate d) compile
c
What does probs.argMax(1).dataSync()[0] return?
a) The probability value of the top class b) The total number of classes c) The sorted array of probabilities d) The index of the highest-probability class
d
In the Student Grade Predictor, what shape must the label tensor have?
a) [N, 1] b) [N, 3] c) [1, N] d) [N]
a
Why does the Student Grade Predictor's label need no one-hot encoding?
a) Because one-hot encoding is too slow in the browser b) Because the output is binary — a single 0/1 value is sufficient c) Because TensorFlow.js does not support one-hot d) Because the label is text-based
b
Which activation function is required in the final layer of the Student Grade Predictor?
a) relu b) softmax c) sigmoid d) tanh
c
Which loss function is required for the Student Grade Predictor?
a) categoricalCrossentropy b) meanSquaredError c) hinge d) binaryCrossentropy
d
Complete the code so the trained grade model is stored in the browser: await model.save('\_\_\_\_://grade-model');
a) indexeddb b) localstorage c) downloads d) browser
a
Complete the code so the saved grade model is reloaded: model = await tf.\_\_\_\_('indexeddb://grade-model');
a) loadModel b) loadLayersModel c) loadGraphModel d) restoreModel
b
On page load, what should happen if the model loads successfully from IndexedDB?
a) Retrain the model immediately b) Show an error to the user c) Skip training d) Save a fresh copy
c
When normalizing the user's typed input in the interface, which min/max should you use?
a) New min/max computed from the entered values b) Min/max from the iris dataset c) Min/max of 0 and 1 d) The same min/max used in training
d
What is the most likely cause of loss becoming NaN during training?
a) Unnormalized inputs or a learning-rate explosion b) Using tf.tidy() c) Splitting the data 80/20 d) Using softmax as the final activation
a
If accuracy is stuck at ~0.5 (binary) or ~0.33 (iris), what is the likely cause?
a) Batch size is too small b) Labels were not shuffled together with features c) The learning rate is too low d) The model has too many layers
b
Complete the fix for the "input shape mismatch" error when predicting: tf.\_\_\_\_([[h, a, q]])
a) tensor1d b) tensor3d c) tensor2d d) scalar
c
What causes the page to freeze over time in a repeated inference loop?
a) The browser cache filling up b) Too many epochs c) Small batch size d) A tensor leak (tensors not disposed)
d
How do you prevent a tensor leak in per-frame or per-click tensor code?
a) Wrap the code in tf.tidy() and dispose prediction tensors b) Increase the learning rate c) Reduce the number of layers d) Use tensor1d instead of tensor2d
a
Complete the call so tfjs-vis draws the training curves: callbacks: tfvis.show.\_\_\_\_({ name: 'Training Performance' }, ['loss', 'val_loss', 'acc', 'val_acc']);
a) show.callbacks b) fitCallbacks c) trainCallbacks d) render.callbacks
b
What does model.predict(sample) do?
a) Trains the model b) Evaluates the model c) Runs inference on the trained model d) Compiles the model
c
Why must the prediction tensor be 2-D (shape [1, 3]) rather than 1-D?
a) Because the model was compiled for regression b) Because softmax only works on 2-D tensors c) Because the model uses a sigmoid activation d) Because the model expects a batch dimension, even when predicting a single row
d
tf.tidy() automatically disposes any tensors created inside its callback.
True
The iris.json file is sorted randomly, so skipping the shuffle step is harmless.
False
For the Student Grade Predictor, the label needs one-hot encoding before training.
False
The recommended loss function for the binary grade predictor is categoricalCrossentropy.
False
If accuracy is stuck at ~0.5 for a binary problem, the likely cause is that labels were not shuffled together with features.
True
The "input shape mismatch" error is fixed by using tf.tensor1d(...) instead of tf.tensor2d(...).
False
If the model loads successfully from IndexedDB on page load, training should be skipped.
True
User input in the grade predictor interface should be normalized with a new min/max computed from the typed values.
False