[function] reduce_dimensions() - P3chys/textmining GitHub Wiki
reduce_dimensions()
Function: Purpose
Reduces dimensionality of feature matrices using Truncated SVD (Latent Semantic Analysis).
Syntax
reduce_dimensions(X, n_components=100, random_state=42)
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
X |
sparse matrix | Required | Input feature matrix |
n_components |
int | 100 | Number of components to retain |
random_state |
int | 42 | Random seed for reproducibility |
Returns
- Tuple: (reduced_matrix, svd_model)
- reduced_matrix: Dense matrix of shape (n_samples, n_components)
- svd_model: Fitted TruncatedSVD object