Skip to content
Reading as a guest: this browser saves your progress. Create a free account and we’ll carry your progress over.

Foundations: Tensors & Data

Mission Map
SECTOR foundations, MISSION 1, 12 min, 1 exercise

From JavaScript Arrays to Tensors

Sensors along the hull measure the signal reaching the Archimedes. Their readings pour onto ’s screen, too quickly to follow as numbers. He opens a chart to see how the readings change over time. Each sensor will have its own line.

The code behind the chart uses TensorFlow.js, the library the crew will also use to build DEEP SCAN. That code expects a , but ’s readings are in a JavaScript array. He needs your help to turn that array into a tensor.

He selects sensors A, B, C, and D at three moments. The recording’s header, the notes saved at the top of the file, gives their order: A, B, C, D each time. These 12 readings are enough to check the connection without loading the full 64-sensor recording.

What the example shows

The is [12]: one axis holding 12 values. It does not tell us which sensor produced a value. That information comes from the recording’s header. Pass streamValues directly to tf.tensor(). Wrapping it in another array adds an axis, giving shape [1, 12] instead.

The supplied chart code groups the readings by sensor and draws a line for each one. In the challenge, you’ll write the tensor creation and shape lines yourself. will help you build the grouping steps in the next mission.

You could plot these values with plain JavaScript too. Here, you’re passing them to the crew’s TensorFlow.js code, which they’ll later use for machine learning.

Challenge

is ready to see the readings on his chart. Create the tensor, save its shape, and run the code. Then select a sensor on the chart to follow its readings over time.

Sensors along the hull measure the signal reaching the Archimedes. Their readings pour onto ’s screen, too quickly to follow as numbers. He opens a chart to see how the readings change over time. Each sensor will have its own line.

The code behind the chart uses TensorFlow.js, the library the crew will also use to build DEEP SCAN. That code expects a , but ’s readings are in a JavaScript array. He needs your help to turn that array into a tensor.

He selects sensors A, B, C, and D at three moments. The recording’s header, the notes saved at the top of the file, gives their order: A, B, C, D each time. These 12 readings are enough to check the connection without loading the full 64-sensor recording.

What the example shows

The is [12]: one axis holding 12 values. It does not tell us which sensor produced a value. That information comes from the recording’s header. Pass streamValues directly to tf.tensor(). Wrapping it in another array adds an axis, giving shape [1, 12] instead.

The supplied chart code groups the readings by sensor and draws a line for each one. In the challenge, you’ll write the tensor creation and shape lines yourself. will help you build the grouping steps in the next mission.

You could plot these values with plain JavaScript too. Here, you’re passing them to the crew’s TensorFlow.js code, which they’ll later use for machine learning.

Challenge

is ready to see the readings on his chart. Create the tensor, save its shape, and run the code. Then select a sensor on the chart to follow its readings over time.