Skip to content

Selection CLI API Reference

The kreview.cli_select module implements kreview select, which scores features and applies a selection strategy to extracted matrices ahead of evaluation.

For conceptual explanations, see:


kreview.cli_select

kreview select — Feature scoring and selection (mRMR / hybrid-union).

Docs: https://msk-access.github.io/kreview/cli_select.html.md

__all__ = ['log', 'select'] module-attribute

CLI command: kreview select — Feature scoring and selection.

Reads *_matrix.parquet files (from kreview extract), scores every numeric feature by univariate AUC and mutual information, then applies feature selection (mRMR by default, or hybrid-union) with a variance guard.

Outputs per evaluator:

  • {name}_matrix.parquet — selected-feature matrix (metadata + top features)
  • {name}_eval_stats.parquet — per-feature scores for ALL features
  • {name}_selection_qc.json — selection audit trail

Registered in the main CLI via::

from kreview.cli_select import select
app.command()(select)

select(matrices_dir=typer.Option(..., '--matrices-dir', help='Directory with *_matrix.parquet files from kreview extract'), top_percentile=typer.Option(50.0, '--top-percentile', help='Top X%% of features to select (controls K for mRMR, or per-metric cutoff for hybrid_union)'), strategy=typer.Option('mrmr', '--strategy', help='Feature selection strategy: mrmr (default, redundancy-aware) or hybrid_union (AUC∪MI)'), cv_folds=typer.Option(5, '--cv-folds', help='Cross-validation folds for univariate AUC scoring'), impute_strategy=typer.Option('median', '--impute-strategy', help='Imputation strategy for variance check: median, mean, zero'), output=typer.Option('output/', '--output', help='Output directory for selected matrices (ignored when --overwrite is set)'), overwrite=typer.Option(False, '--overwrite', help='Overwrite original matrices in --matrices-dir instead of writing to --output'), compute_univariate_auc=typer.Option(True, '--compute-univariate-auc/--no-compute-univariate-auc', help='Compute per-feature univariate AUC (disable for MI-only selection)'), seed=typer.Option(42, '--seed', help='Random seed for reproducibility.'))

Score features and apply feature selection to extracted matrices.

Reads all *_matrix.parquet files from --matrices-dir, computes feature scores (univariate AUC + mutual information), and selects the top features using mRMR (default, redundancy-aware) or hybrid union (top N%% by AUC ∪ top N%% by MI).

Writes selected matrices, eval stats, and QC metadata to --output (or overwrites originals when --overwrite is set).