structboost.column_norms_sq¶
- structboost.column_norms_sq(sourcemat)[source]¶
Squared column norms
||x_j||^2of the boosting design matrix.Exposed so a caller that invokes
allboost()repeatedly against the samesourcemat– which is whatstructboost.BAE.fit()does, once per training iteration – can compute this once and pass it back in. It is otherwise recomputed on every call, an O(n*p) pass that also allocates a full(n_samples, n_features)temporary.Using this helper rather than open-coding the expression is what guarantees a hoisted value is bit-for-bit the one
allboostwould have computed itself.einsumrather than(sourcemat**2).sum(axis=0): the latter materializes a full(n_samples, n_features)squared copy, 1.4 GB at 60k x 6k, purely to reduce it away again.