Python and NumPy

Recompute scores from a restored report

BOTIE

Compute one weighted score per restored feature row, then collect the scores and the names together, scores first.
Ready to test
0 passed · 0 failed · 1 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.

Try your own inputs

Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

Compute one weighted score per restored feature row, then collect the scores and the names together, scores first.

The feature table, weights and greenhouse names have already been restored. Botie must check whether they still describe one aligned report.

Multiply the restored feature table by its coefficient vector, then collect the score vector before the corresponding names.

Examples and results
Restored feature table
1040
2060
Restored coefficients
  1. 02
  2. 10.1
Restored names in row order
  1. 0north
  2. 1south
Required result
[
  [
    24,
    46
  ],
  [
    "north",
    "south"
  ]
]
Try a fresh construction

This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.

Stuck? Inspect a worked construction

The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.

Assumptions and test precision

The workshop starts after loading and checks how the restored data is used. The Python examples and challenges perform the actual file-format round trips in memory. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

Restored rows with signed coefficients

This check uses the pieces from “Recompute named scores from restored pieces”.

BOTIE

This restored file contains three named rows and a negative coefficient. Predict the score list followed by its aligned names.
Restored feature table
02
31
22
Restored coefficients
  1. 02
  2. 1-1
Restored names in row order
  1. 0west
  2. 1east
  3. 2annex

Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.

Build a construction in the workspace above first. This case will test those pieces.

Which pieces would be missing if you saved only the score vector, and which part of an actual file round trip is outside this workshop?

Store the data, fitted quantities and identity information required to reproduce a calculation.

The workshop starts after loading and checks how the restored data is used. The Python examples and challenges perform the actual file-format round trips in memory.

Work through the Python challenges →
← Give a Reusable Calculation a Clear Contract