randomized.slope¶
Module: randomized.slope
¶
Inheritance diagram for selectinf.randomized.slope
:
slope
¶
-
class
selectinf.randomized.slope.
slope
(loglike, slope_weights, ridge_term, randomizer, perturb=None)[source]¶ Bases:
selectinf.randomized.query.gaussian_query
-
__init__
(loglike, slope_weights, ridge_term, randomizer, perturb=None)[source]¶ Create a new post-selection object for the SLOPE problem
- Parameters
loglike : regreg.smooth.glm.glm
A (negative) log-likelihood as implemented in regreg.
slope_weights : np.ndarray
SLOPE weights for L-1 penalty. If a float, it is broadcast to all features.
ridge_term : float
How big a ridge term to add?
randomizer : object
Randomizer – contains representation of randomization density.
perturb : np.ndarray
Random perturbation subtracted as a linear term in the objective function.
-
static
gaussian
(X, Y, slope_weights, sigma=1.0, quadratic=None, ridge_term=0.0, randomizer_scale=None)[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)¶
-
setup_sampler
()¶ Setup query to prepare for sampling. Should set a few key attributes:
observed_score_state
observed_opt_state
opt_transform
-
solve
()¶
-
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?
-
useC
= True¶
-