PLS-DA
Partial Least Squares Discriminant Analysis with double cross-validation.
Functions
motco.stats.pls.plsda_doubleCV(X, y, cv1_splits=7, cv2_splits=8, n_repeats=30, max_components=50, random_state=1203, n_jobs=1, progress=True)
Estimate a double cross validation on a partial least squares regression - discriminant analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
DataFrame
|
The predictor variables. |
required |
y
|
Union[DataFrame, Series]
|
The outcome varibale. |
required |
cv1_splits
|
int
|
Number of folds in the CV1 loop. Default: 7. |
7
|
cv2_splits
|
int
|
Number of folds in the CV2 loop. Default: 8. |
8
|
n_repeats
|
int
|
Number of repeats to the cv2 procedure. Default: 30. |
30
|
max_components
|
int
|
Maximum number of LV to test. Default: 50. |
50
|
random_state
|
int
|
For reproducibility. Default: 1203. |
1203
|
n_jobs
|
int
|
Number of parallel workers for the inner CV loop. Use -1 for all available CPUs. Default: 1 (serial). |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
models_table |
dict[str,
|
Dictionary with the table of the best models, including repetition, number of latent variables, and AUROC. Also includes the model for prediction. |
Source code in src/motco/stats/pls.py
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 | |
motco.stats.pls.calculate_vips(model, components=None)
Estimates Variable Importance in Projection (VIP) in Partial Least Squares (PLS)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
model generated from the PLSRegression function |
required | |
components
|
Union[None, list[int]]
|
if not None, a list of integers indicating the components to compute the VIPs from. If None, all components are taken into account. Default None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
vips |
array
|
variable importance in projection for each variable |
Source code in src/motco/stats/pls.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |