RandomProjection n_components=auto: verify resolved dimensions and output names together
auto describes the request; fitting resolves the actual dimension. Feature names and output containers must use that resolved value.
Handing over an automatic configuration result
Distinguish the requested setting from the dimension resolved by fitting. An analyst may select auto, but the person constructing the next table needs a real width and names for its columns. Leaving the word auto where the resolved dimension belongs breaks the contract between numerical projection and name generation. [1, 2, 3]
A path hidden by fixed-dimension tests
scikit-learn issue 34993 reports BaseRandomProjection storing requested n_components instead of resolved n_components_ as the output-feature count. With auto, feature-name generation raises TypeError and pandas output also fails. The report contrasts tests using a fixed dimension. Its example expects 110 output columns, but that is not a setting to apply to every dataset. [1]
Record the request and resolved result separately
Keep the inferred n_components and output-name list together, checking dimension handoff under both automatic and fixed configurations. Do not overwrite the requested configuration with the fitted result in one field. A failure to generate names is first an execution failure, not a valid empty name list that can simply proceed to width validation. [1, 3]
Where the expected 110 comes from
If an illustrative fit resolves the dimension to 110, the expected name count is also 110. Obtaining 110 names satisfies cardinality; obtaining 0 because generation failed does not. Derive the expectation from the fitted dimension rather than copying the length of the list under test. Matching count still leaves the mapping and order of names to projection columns to be checked separately. [1, 3]
Reconcile name count with the resolved dimension in Truthound
ColumnPairValidator in Truthound Core 3.3.2 can compare output_name_count with inferred_components in a prepared audit table. If name generation fails, preserve the failure status separately and record the 0 names obtained. Do not approve that as a valid empty output. Check missing comparison values first. Testing only the projection table width can miss a case where numeric columns exist but name generation fails. Equal counts do not establish name order, distance preservation or statistical suitability of the selected dimension. [1, 2, 3]
Application conditions
Prepare requested_components, inferred_components, output_name_count and name-generation success from execution records. If failure prevents name generation, retain that failure state and record a name count of 0. Check missingness separately in the two counts being compared.
Alternatives
Record the resolved dimension in the artifact and verify feature-name generation for that dimension.
Limitations
Counting names does not establish projection-distance preservation or statistical suitability of the dimension choice.
Evidence
- Event checked
- Subject checked
- Modified
