Skip to main content

Grade 12 · 18 weeks

Computer Science

Build and test a Lantern Festival scorer, model data, and design a program that people can use without giving up unnecessary personal information.

Start Week 12

Term 2 · Data, networks and computing impacts

Modeling relationships with data

A computational model turns a relationship into rules that can generate predictions. Toy data can test the code. Observations from a separate sample help evaluate whether the model is useful.

Read-aloud is not available in this browser. You can still read this text on screen.

Computing lab

The starter predicts tokens from rounds. Use four collected counts from an approved nonpersonal activity, or use the supplied pairs (1, 2), (2, 3), (3, 6), (4, 7) of rounds and tokens. Compare model errors and test a revision on a fifth observed or instructor-supplied pair.

Keep for review. Model code, a predicted-versus-observed table, an error comparison and a limitation.

JavaScript starter code

Save this example as a .js file and run it in Node.js or an editor your educator approves.

function predictTokens(rounds) {
  return rounds * 2;
}
for (const [rounds, observed] of [[1, 2], [2, 3], [3, 6], [4, 7]]) {
  const predicted = predictTokens(rounds);
  console.log(rounds, observed, predicted, observed - predicted);
}
Why keep one observation out of the model-revision step?
Plan the week
  1. Read the lesson and explain its main idea in your own words.
  2. State the system or program’s goal and sketch its inputs, rules and output.
  3. Complete the investigation and keep the evidence listed above.
  4. Test or trace a second case and record any change it suggests.
  5. Answer the week’s check, then explain your reasoning using your evidence.

Keep your practice projects local or share them with an approved reviewer. Use fictional or nonpersonal data in your programs and tests.

Academy curriculum for family use. Course credit is subject to school and educator approval.

Quest progressProgress recorded