LDPredInfGrid
LDPredInfGrid
¶
Bases: LDPredInf
LDpred-inf with penalty selection by summary-statistic splitting.
The model searches over combinations of the allele-frequency exponent and multiplicative factors for the theoretical LDpred-inf penalty. Each candidate is fitted to a PUMAS training split and evaluated against the held-out summary statistics using pseudo-validation R-squared. The selected model is then fitted to the full summary statistics.
Attributes:
| Name | Type | Description |
|---|---|---|
penalty_factors |
The candidate multipliers for the LDpred-inf penalty. |
|
selected_penalty_factor |
The multiplier selected by pseudo-validation. |
|
alpha_grid |
The candidate allele-frequency exponents. |
|
selected_alpha |
The exponent selected by pseudo-validation. |
|
validation_result |
A table containing the score for every candidate. |
Source code in viprs/model/gridsearch/LDPredInfGrid.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
__init__(gdl, h2=None, penalty_factors=None, alpha=0.0, alpha_grid=None)
¶
Initialize an LDpred-inf penalty grid search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gdl
|
An instance of |
required | |
h2
|
Genome-wide heritability, or a dictionary mapping chromosomes to chromosome-specific heritability estimates. |
None
|
|
penalty_factors
|
Positive multipliers for the theoretical penalty.
By default, nine logarithmically spaced values from |
None
|
|
alpha
|
The allele-frequency exponent used when |
0.0
|
|
alpha_grid
|
Optional allele-frequency exponents to include in the grid search. |
None
|
Source code in viprs/model/gridsearch/LDPredInfGrid.py
fit(prop_train=0.8, seed=None, refit=True, **solver_kwargs)
¶
Select the penalty factor and fit the LDpred-inf model.
This method first creates training and validation summary statistics,
fits every combination of alpha and penalty factor to the training
split, and selects the candidate with the highest finite
pseudo-validation R-squared. By default, the selected model is finally
refitted to the full GWAS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prop_train
|
The proportion of the GWAS sample assigned to the training summary statistics. |
0.8
|
|
seed
|
The random seed for summary-statistic splitting. |
None
|
|
refit
|
If True, refit the selected model to the full summary statistics. |
True
|
|
solver_kwargs
|
Keyword arguments passed to |
{}
|
Returns:
| Type | Description |
|---|---|
|
The fitted model using the selected penalty factor. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If pseudo-validation produces no finite scores. |
Source code in viprs/model/gridsearch/LDPredInfGrid.py
to_validation_table()
¶
Return the results of the penalty grid search.
Returns:
| Type | Description |
|---|---|
|
A copy of the validation table containing alpha values, penalty factors, pseudo-validation scores, and the selected model indicator. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the model has not been fitted. |