randomized.cv_view

Module: randomized.cv_view

Inheritance diagram for selectinf.randomized.cv_view:

digraph inheritancef4ebd4873b { rankdir=LR; size="8.0, 12.0"; "randomized.cv_view.CV_view" [URL="#selectinf.randomized.cv_view.CV_view",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top"]; "randomized.query.query" -> "randomized.cv_view.CV_view" [arrowsize=0.5,style="setlinewidth(0.5)"]; "randomized.query.query" [URL="selectinf.randomized.query.html#selectinf.randomized.query.query",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="This class is the base of randomized selective inference"]; }

CV_view

class selectinf.randomized.cv_view.CV_view(glm_loss, loss_label, lasso_randomization=None, epsilon=None, scale1=None, scale2=None)[source]

Bases: selectinf.randomized.query.query

__init__(glm_loss, loss_label, lasso_randomization=None, epsilon=None, scale1=None, scale2=None)[source]
Parameters

randomization : selection.randomized.randomization.randomization

Instance of a randomization scheme. Describes the law of \(\omega\).

perturb : ndarray, optional

Value of randomization vector, an instance of \(\omega\).

solve(glmnet=False, K=5)[source]
setup_sampler()[source]

Setup query to prepare for sampling. Should set a few key attributes:

  • observed_score_state

  • observed_opt_state

  • opt_transform

one_SD_rule(direction='up')[source]
projection(opt_state)[source]
condition_on_opt_state()[source]
get_sampler()
randomize(perturb=None)

The actual randomization step.

Parameters

perturb : ndarray, optional

Value of randomization vector, an instance of \(\omega\).

property sampler

Sampler of optimization (augmented) variables.

selective_MLE(observed_target, target_cov, target_score_cov, level=0.9, solve_args={'tol': 1e-12})
Parameters

observed_target : ndarray

Observed estimate of target.

target_cov : ndarray

Estimated covaraince of target.

target_score_cov : ndarray

Estimated covariance of target and score of randomized query.

level : float, optional

Confidence level.

solve_args : dict, optional

Arguments passed to solver.

set_sampler(sampler)
summary(observed_target, target_cov, target_score_cov, alternatives, opt_sample=None, target_sample=None, parameter=None, level=0.9, ndraw=10000, burnin=2000, compute_intervals=False)

Produce p-values and confidence intervals for targets of model including selected features

Parameters

target : one of [‘selected’, ‘full’]

features : np.bool

Binary encoding of which features to use in final model and targets.

parameter : np.array

Hypothesized value for parameter – defaults to 0.

level : float

Confidence level.

ndraw : int (optional)

Defaults to 1000.

burnin : int (optional)

Defaults to 1000.

compute_intervals : bool

Compute confidence intervals?

dispersion : float (optional)

Use a known value for dispersion, or Pearson’s X^2?

selectinf.randomized.cv_view.projection(Z, idx)[source]