Skip to content

Commit a06d379

Browse files
committed
update readme
1 parent 0a5db9c commit a06d379

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

README.md

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -133,29 +133,7 @@ vimp_precompute.hyp_test_
133133
## -------------------------------------------------------------
134134
## get variable importance estimates using cross-validation
135135
## -------------------------------------------------------------
136-
np.random.seed(5678)
137-
folds_inner_1 = np.random.choice(a = np.arange(5), size = np.sum(folds_outer == 1), replace = True)
138-
folds_inner_0 = np.random.choice(a = np.arange(5), size = np.sum(folds_outer == 0), replace = True)
139-
folds = [folds_outer, folds_inner_1, folds_inner_0]
140-
x_1, y_1 = x[folds_outer == 1, :], y[folds_outer == 1]
141-
x_0, y_0 = x[folds_outer == 0, :], y[folds_outer == 0]
142-
preds_f = np.empty((y_1.shape[0],))
143-
preds_f.fill(np.nan)
144-
preds_r = np.empty((y_0.shape[0],))
145-
preds_r.fill(np.nan)
146-
for v in range(5):
147-
fold_cond_1 = np.flatnonzero(folds_inner_1 == v)
148-
fold_cond_0 = np.flatnonzero(folds_inner_0 == v)
149-
x_train_0, y_train_0 = x_0[folds_inner_0 != v, :], y_0[folds_inner_0 != v]
150-
x_test_0, y_test_0 = x_0[folds_inner_0 == v, :], y_0[folds_inner_0 == v]
151-
x_train_1, y_train_1 = x_1[folds_inner_1 != v, :], y_1[folds_inner_1 != v]
152-
x_test_1, y_test_1 = x_1[folds_inner_1 == v, :], y_1[folds_inner_1 == v]
153-
cv_full.fit(x_train_1, np.ravel(y_train_1))
154-
preds_v_1 = cv_full.predict(x_test_1)
155-
cv_full.fit(x_train_0[:, np.delete(np.arange(p), 1)], np.ravel(y_train_0))
156-
preds_v_0 = cv_full.predict(x_test_0[:, np.delete(np.arange(p), 1)])
157-
preds_f[fold_cond_1] = preds_v_1
158-
preds_r[fold_cond_0] = preds_v_0
136+
np.random.seed(12345)
159137
## set up the vimp object
160138
vimp_cv = vimpy.cv_vim(y = y, x = x, s = 1, pred_func = cv_full, V = 5, measure_type = "r_squared")
161139
## get the point estimate

0 commit comments

Comments
 (0)