Pin the feature order before building X.

highlighted = computed this step

State the feature order

Use feature order first feature, then second feature. That order fixes how each row becomes a row of X.

feature order=(xfirst,xsecond)\text{feature order}=(x_{\text{first}},x_{\text{second}})
Feature Matrix ExactlyExact rows rewritten into X, y, and intercept X plus.rows to X, y, and intercept X plusrow idx1x2yX rowy entryX+ rowA125[1,2]5[1,1,2]B214[2,1]4[1,2,1]C338[3,3]8[1,3,3]feature order: x1, x2; row ids stay outside Xintercept column is all ones in X+feature matrix is a table rewrite from displayed rowsrow IDs stay outside X; intercept column is all onesNOT training; NOT learning; NOT predictionNOT accuracy; NOT generalization; NOT feature importanceNOT best features; NOT causal; NOT probability truth

Read row A in that order

Row A contributes X row [1,2] because the first feature is read before the second feature.

AX=[1,2]A_X=[1,2]
Feature Matrix ExactlyExact rows rewritten into X, y, and intercept X plus.rows to X, y, and intercept X plusrow idx1x2yX rowy entryX+ rowA125[1,2]5[1,1,2]B214[2,1]4[1,2,1]C338[3,3]8[1,3,3]feature order: x1, x2; row ids stay outside Xintercept column is all ones in X+feature matrix is a table rewrite from displayed rowsrow IDs stay outside X; intercept column is all onesNOT training; NOT learning; NOT predictionNOT accuracy; NOT generalization; NOT feature importanceNOT best features; NOT causal; NOT probability truth

Order is part of the rewrite

Changing the feature order would make a different matrix. This lesson pins first feature, then second feature.

pinned order: xfirst then xsecond\text{pinned order: } x_{\text{first}} \text{ then } x_{\text{second}}
Feature Matrix ExactlyExact rows rewritten into X, y, and intercept X plus.rows to X, y, and intercept X plusrow idx1x2yX rowy entryX+ rowA125[1,2]5[1,1,2]B214[2,1]4[1,2,1]C338[3,3]8[1,3,3]feature order: x1, x2; row ids stay outside Xintercept column is all ones in X+feature matrix is a table rewrite from displayed rowsrow IDs stay outside X; intercept column is all onesNOT training; NOT learning; NOT predictionNOT accuracy; NOT generalization; NOT feature importanceNOT best features; NOT causal; NOT probability truth