parametric_si.sfs_si module
- parametric_si.sfs_si.parametric_sfs_cv_si(X: numpy.ndarray, y: numpy.ndarray, k_candidates: List[float], k_folds: int, sigma: int = 1, alpha: float = 0.05) parametric_si.si.SI_result
Compute selective p-values and selective confidence intervals for the coefficients of the features selected by forward SFS at the value of the hyperparameter k chosen by cross-validation.
This function computes selective p-values and confidence intervals for the coefficient of the features selected by forward SFS at the value of the hyperparameter k chosen by cross-validation.
- Parameters
X (np.ndarray) – feature matrix of shape (n_samples, p_features)
y (np.ndarray) – response vector of shape (n_samples, 1)
k_candidates (List[float]) – list of candidates for hyperparameter k
k_folds (int) – number of folds in cross validation
sigma (int, optional) – variance for selective inference, default=1.0.
alpha (float, optional) – significance level for confidence intervals, default=0.05.
- Returns
please reffer to document of SI_result
- Return type
- parametric_si.sfs_si.parametric_sfs_si(X: numpy.ndarray, y: numpy.ndarray, k: int, sigma: int = 1, alpha: float = 0.05) parametric_si.si.SI_result
Compute selective p-values and selective confidence intervals for the coefficients of the features selected by forward SFS at a fixed value of the hyperparameter k.
This function computes selective p-values and selective confidence intervals for the coefficients of the features selected by forward SFS at a fixed value of the hyperparameter k.
- Parameters
X (np.ndarray) – feature matrix of shape (n_samples, p_features)
y (np.ndarray) – response vector of shape (n_samples, 1)
k (int) – number of features to be selected (hyperparameter)
sigma (int, optional) – variance for selective inference, default=1.0.
alpha (float, optional) – significance level for confidence intervals, default=0.05.
- Returns
reffer to document of SI_result
- Return type
parametric_si.lasso_si module
- parametric_si.lasso_si.parametric_lasso_cv_si(X, y, k_candidates, k_folds, sigma=1, alpha=0.05)
Compute selective p-values and selective confidence intervals for the coefficients of features selected by Lasso at the value of the hyperparameter k chosen by cross-validation.
This function computes selective p-values and selective confidence intervals for the coefficients of features selected by Lasso at the value of the regularization parameter k chosen by cross-validation.
- Parameters
X (np.ndarray) – feature matrix of shape (n_samples, p_features)
y (np.ndarray) – response vector of shape (n_samples, 1)
k_candidates (List[float]) – list of candidates for k
k_folds (int) – number of folds in cross validation
sigma (int, optional) – variance for selective inference, default=1.0.
alpha (float, optional) – significance level for confidence intervals, default=0.05.
- Returns
please refer to document of SI_result
- Return type
- parametric_si.lasso_si.parametric_lasso_si(X, y, k, sigma=1, alpha=0.05)
Compute selective p-values and selective confidence intervals for the coefficients of features selected by Lasso at a fixed value of the hyperparameter k.
This function computes selective p-values and selective confidence intervals for the coefficients of features selected by Lasso at a fixed value of the hyperparameter k.
- Parameters
X (np.ndarray) – feature matrix of shape (n_samples, p_features)
y (np.ndarray) – response vector of shape (n_samples, 1)
k (int) – regularization parameter of lasso
sigma (int, optional) – variance for selective inference, default=1.0.
alpha (float, optional) – significance level for confidence intervals, default=0.05.
- Returns
reffer to document of SI_result
- Return type
parametric_si.lasso_si module
- parametric_si.lars_si.parametric_lars_cv_si(X, y, k_candidates, k_folds, sigma=1, alpha=0.05)
Compute selective p-values and selective confidence intervals for the coefficients estimated by LARS algorithm at the value of the hyperparameter k chosen by cross-validation.
This function computes selective selective p-values and selective confidence intervals for the coefficients of features selected by LARS at the value of the hyperparameter k chosen by cross-validation. Feature matrix must be centered and scaled, and the response vector must be centered.
- Parameters
X (np.ndarray) – feature matrix of shape (n_samples, p_features)
y (np.ndarray) – response vector of shape (n_samples, 1)
k_candidates (List[float]) – list of candidates for k
k_folds (int) – number of folds in cross validation
sigma (int, optional) – variance for selective inference, default=1.0.
alpha (float, optional) – significance level for confidence intervals, default=0.05.
- Returns
please refer to document of SI_result
- Return type
- parametric_si.lars_si.parametric_lars_si(X: numpy.matrix, y: numpy.matrix, k: int, sigma=1, alpha=0.05)
Compute selective p-values and selective confidence intervals for the coefficients estimated by LARS algorithm at a fixed value of the hyperparameter k.
This function computes selective p-values and selective confidence intervals for the coefficients of features selected by LARS at a fixed value of the hyperparameter k. Feature matrix must be centered and scaled, and the response vector must be centered.
- Parameters
X (np.ndarray) – feature matrix of shape (n_samples, p_features)
y (np.ndarray) – response vector of shape (n_samples, 1)
k (int) – number of feature to be selected (hyperparameter)
sigma (int, optional) – variance for selective inference, default=1.0.
alpha (float, optional) – significance level for confidence intervals, default=0.05.
- Returns
refer to document of SI_result
- Return type
parametric_si.si module
- class parametric_si.si.SI_result(A: list, k: float, sigma: float, p_values: list, CIs: list)
this class returns the results of selective inference. Each selective inference function returns this class.
- A
list of selected features
- Type
List[int]
- k
hyperparameter of the feature selection algorithm
- Type
float
- sigma
variance used for inference.
- Type
float
- p_values
p-values of the selected features
- Type
List[float]
- CIs
confidence intervals of the selected features
- Type
List[portion.interval.Interval]
- parametric_si.si.estimate_sigma(X: numpy.ndarray, y: numpy.ndarray) float
this function estimates variance by using the all features.
- Parameters
X (np.ndarray) – feature matrix of shape (n_samples, p_features)
y (np.ndarray) – response vector of shape (n_samples, 1)
- Returns
estimated variance
- Return type
float
- parametric_si.si.estimate_sigma_lasso(X: numpy.ndarray, y: numpy.ndarray) float
this function estimates the variance by only using the selected features.
- Parameters
X (np.ndarray) – feature matrix of shape (n_samples, p_features)
y (np.ndarray) – response vector of shape (n_samples, 1)
- Returns
estimated variacnce
- Return type
float