Speed

Choose Feature Columns

Select an explicit, ordered subset of predictor columns while excluding identifiers, uninformative codes, and the target column itself.

The problem

Dropping row_id in Raw Table Has Row IDs removed one non-feature column, yet real tables hold several more traps. A five-column apartment table [id, area, badge, rooms, rent] mixes an identifier (id), two genuine physical predictors (area and rooms), an arbitrary broker badge code, and the outcome we want to predict (rent).

Leaving rent inside the predictor list commits target leakage—handing the answer key directly to the model—while permuting [area, rooms] into [rooms, area] silently swaps which feature each learned weight multiplies at deployment.

Work through the numbers

Examine five records [id, area, badge, rooms, rent]: [10, 40, 7, 1, 90], [20, 60, 3, 2, 140], [30, 50, 9, 2, 120], [40, 80, 1, 3, 190], and [50, 70, 5, 3, 170]. Notice that rent follows 2 * area + 10 * rooms (2 * 40 + 10 * 1 = 90, 2 * 60 + 10 * 2 = 140).

Choosing the ordered column pair [1, 3] ([area, rooms]) extracts the 5-by-2 matrix [[40, 1], [60, 2], [50, 2], [80, 3], [70, 3]]. Column 0 (id), column 2 (badge), and column 4 (rent) never enter X. If column 2 (badge) replaced column 3 (rooms), slot 1 would become [7, 3, 9, 1, 5]; if column 4 (rent) slipped in, slot 1 would leak [90, 140, 120, 190, 170].

The live model

The left grid colors raw predictors area and rooms blue, target rent amber, and unused columns grey; the right grid shows the chosen 5-by-2 feature block. At default use_rooms = 1, Chosen X holds [area, rooms] ([[40, 1], [60, 2], [50, 2], [80, 3], [70, 3]]). Slide use_rooms to 0 to substitute broker badge into column 1 ([[40, 7], [60, 3], [50, 9], [80, 1], [70, 5]]), illustrating how changing the column selector alters the coordinate space.

Five-column raw table highlighting chosen predictors area (col 1) and rooms (col 3) while excluding row_id, badge, and target rent.
let use_rooms = scene.parameter("use_rooms", 1.0, 0.0, 1.0, 1.0);
let table = input;
let area = table.select(1, 1);
let badge = table.select(1, 2);
let rooms = table.select(1, 3);
let second = badge * (1.0 - use_rooms) + rooms * use_rooms;
let answer = torch.stack(torch.list().add(area).add(second), 1);
out.set("chosen_features", answer);
{
  "chosen_features": [
    [
      40,
      1
    ],
    [
      60,
      2
    ],
    [
      50,
      2
    ],
    [
      80,
      3
    ],
    [
      70,
      3
    ]
  ]
}

Your turn

Look at slot 1 of the starter's output: outcomes 90..190 sit inside the predictor block in red, handing the target straight to the model while omitting room counts. Assemble answer from the two physical apartment attributes in [area, rooms] order. Check grades on a four-row table and a six-row table whose rents include market noise.

The starter leaks target rent (col 4) into slot 1 of the predictor matrix instead of selecting rooms (col 3).
let table = input;
let area = table.select(1, 1);
let rooms = table.select(1, 3);
let rent = table.select(1, 4);
let answer = torch.stack(torch.list().add(area).add(rent), 1);
out.set("chosen_features", answer);
{
  "chosen_features": [
    [
      40,
      90
    ],
    [
      60,
      140
    ],
    [
      50,
      120
    ],
    [
      80,
      190
    ],
    [
      70,
      170
    ]
  ]
}

Form the N-by-2 predictor matrix answer from input so only the two physical apartment attributes enter, in [area, rooms] order, with no target leakage.

With target outcomes excluded and room counts in slot 1, the right-hand block turns green at [[40, 1], [60, 2], [50, 2], [80, 3], [70, 3]].

Read the result carefully

Treat the chosen column list ["area", "rooms"] as an immutable schema contract between training and inference. Selecting "all columns except index 0" breaks the moment a data engineer appends a post-outcome audit column or reorders CSV headers.

Naming exact predictor indices—and asserting that neither the target nor post-event summaries appear among them—matters because a leaked target fits perfectly by construction: in this table rent is exactly 2 * area + 10 * rooms, so any X containing column 4 reproduces every label with zero residual and tells you nothing about generalization.

Recap

  • Explicitly whitelist predictor columns ([area, rooms] at indices 1 and 3) rather than taking blind slices of a wide table.
  • Keep outcome columns (rent at index 4) strictly out of X to prevent target leakage.
  • Preserve exact column order ([area, rooms], never [rooms, area]) so every column aligns with its corresponding model weight.