Model Selection & Regression Modules

BBSR

class inferelator.regression.bbsr_python.BBSRRegressionWorkflowMixin

Bayesian Best Subset Regression (BBSR)

https://doi.org/10.15252/msb.20156236

set_regression_parameters(prior_weight=None, no_prior_weight=None, bsr_feature_num=None, clr_only=None, ordinary_least_squares_only=None)

Set regression parameters for BBSR

Parameters:
  • prior_weight (float) – Weight for edges that are present in the prior network. Defaults to 1.
  • no_prior_weight (float) – Weight for edges that are not present in the prior network. Defaults to 1.
  • bsr_feature_num (int) – The number of features to include in best subset regression. Defaults to 10.
  • clr_only (bool) – Only use Context Likelihood of Relatedness to select features for BSR, not prior edges. Defaults to False.
  • ordinary_least_squares_only (bool) – Use OLS instead of Bayesian regression, for testing. Defaults to False.

AMuSR

class inferelator.regression.amusr_regression.AMUSRRegressionWorkflowMixin

Multi-Task AMuSR regression

https://doi.org/10.1371/journal.pcbi.1006591

set_regression_parameters(prior_weight=None, lambda_Bs=None, lambda_Ss=None, heuristic_Cs=None, tol=None, relative_tol=None)

Set regression parameters for AmUSR.

Parameters:
  • prior_weight (numeric) – Weight for edges that are present in the prior network. Non-prior edges have a weight of 1. Set this to 1 to weight prior and non-prior edges equally, Defaults to 1.
  • lambda_Bs (list(floats) or np.ndarray(floats)) – Lambda_B values to search during model selection. If not set, lambda_B will be chosen using the heuristic lambda_b = c * sqrt(d log p / n) from Castro 2019 Defaults to not set. Must be provided if lambda_S is set.
  • lambda_Ss (list(floats) or np.ndarray(floats)) – Lambda_S values to search during model selection. If not set, lambda_S will be chosen using the heuristic 0.5 < lambda_s/lambda_b < 1 from Castro 2019 Defaults to not set.
  • heuristic_Cs (list(floats) or np.ndarray(floats)) – c values to search during model selection. Values of c to calculate lambda_b = c * sqrt(d log p / n), Defaults to np.logspace(np.log10(0.01), np.log10(10), 20)[::-1]. Does not have an effect if lambda_B is provided.
  • tol (float) – Convergence tolerance for amusr regression
  • relative_tol (float) – Relative convergence tolerance for amusr regression

Scikit-Learn

class inferelator.regression.sklearn_regression.SKLearnWorkflowMixin(*args, **kwargs)

Use any scikit-learn regression module

set_regression_parameters(model=None, add_random_state=None, **kwargs)

Set parameters to use a sklearn model for regression

Parameters:
  • model (BaseEstimator subclass) – A scikit-learn model class
  • add_random_state (bool) – Flag to include workflow random seed as “random_state” in the model
  • kwargs (any) – Any arguments which should be passed to the scikit-learn model class instantiation

Elastic-Net

class inferelator.regression.elasticnet_python.ElasticNetWorkflowMixin(*args, **kwargs)

Set default parameters to run scikit-learn ElasticNetCV

set_regression_parameters(model=None, add_random_state=None, **kwargs)

Set parameters to use a sklearn model for regression

Parameters:
  • model (BaseEstimator subclass) – A scikit-learn model class
  • add_random_state (bool) – Flag to include workflow random seed as “random_state” in the model
  • kwargs (any) – Any arguments which should be passed to the scikit-learn model class instantiation

StARS-Lasso

class inferelator.regression.stability_selection.StARSWorkflowMixin(*args, **kwargs)

Stability Approach to Regularization Selection (StARS)-LASSO. StARS-Ridge is implemented on an experimental basis.

https://arxiv.org/abs/1006.3316 https://doi.org/10.1016/j.immuni.2019.06.001

set_regression_parameters(alphas=None, num_subsamples=None, method=None, **kwargs)

Set regression parameters for StARS-LASSO

Parameters:
  • alphas (list(float)) – A list of alpha (L1 term) values to search. Defaults to logspace between 0. and 10.
  • num_subsamples (int) – The number of groups to break data into. Defaults to 20.
  • method (str) – The model to use. Can choose from ‘lasso’ or ‘ridge’. Defaults to ‘lasso’. If ‘ridge’ is set, ridge_threshold should also be passed. Any value below ridge_threshold will be set to 0.
  • kwargs (any) – Any additional arguments will be passed to the LASSO or Ridge scikit-learn object at instantiation