coonfit.parallel_helpers#

Internal worker functions for parallelized regression computations.

This module contains the individual job functions executed by worker processes in the coonfit parallel pipeline. These functions are not part of the public API and are called exclusively by parallel.

Worker functions cover:

  • Matrix aggregation: Combining partial X.T @ X or beta matrices received from a multiprocessing queue (_combine_matrices()).

  • Partial products: Computing X.T @ X and beta coefficients for a single spatial block (_partial_transposed_product(), _partial_optimal_betas()).

  • Predictor validation: Counting valid pixels per predictor band and checking that each band meets the minimum contribution threshold (_process_band_count_valid(), _check_predictor_consistency()).

  • Model prediction: Applying fitted regression weights to a spatial block to produce model output values (_block_model_prediction()).

  • Goodness-of-fit: Partially computing the sum of squared residuals (SSR) and total sum of squares (SST) for RMSE and R² evaluation (_block_ssr(), _block_sst()).