]

split_types = [["splitting"], ["sampling", 2, 2]]
probs = [.5, .7]
selection_methods = ["DSS", "MSS"]

data = [x, t]

for modeling in modelings:
    for split_type, prob, selection_method in zip(split_types, probs,
                                                  selection_methods):

        DSS_selection = barber_candes_selection.BarberCandesSelection(
            data,
            modeling,
            selection_method,
            q=q,
            split_type=split_type,
            prob=prob).selection()

        S_dss = DSS_selection.S
        fdr_dss = 100 * utils.FDR(S_dss, true_index)
        power_dss = 100 * utils.power(S_dss, true_index)
        with open('{}-{}.txt'.format(selection_method, type), 'a') as f:
            print('------------{} ({}, {})-------------'.format(
                selection_method, modeling["model"], modeling["params"]),
                  file=f)
            print(selection_method + "-" + split_type[0] + "-" + str(prob),
                  file=f)
            print("FDR:  " + str(fdr_dss) + "%", file=f)
            print("power:  " + str(power_dss) + "%", file=f)
Example #2
0
VI_stats = ["Diff", "Max"]
optimizations = ["SDP", "samplecorr"]


selection_methods = ["knockoff-MX"]


for selection_method in selection_methods:
	for optimization in optimizations:

		myknockoff = knockoff_features_construction.Knockoff(x, selection_method, optimization)
		knockoff_attrs = myknockoff.knockoff_features()
		x, x_tilda= knockoff_attrs.X, knockoff_attrs.X_tilde
		data = [x, x_tilda, t] 
		for modeling in modelings:
			for VI_stat in VI_stats:

				knockoff_selection = barber_candes_selection.BarberCandesSelection(data, modeling, selection_method,q=q, VI_stat=VI_stat).selection()

				S_knock = knockoff_selection.S
				fdr_knock = 100*utils.FDR(S_knock, true_index)
				power_knock = 100*utils.power(S_knock, true_index)
				with open('{}-{}.txt'.format(selection_method, type), 'a') as f:
					print('------------Knockoff ({})-------------'.format(modeling["model"]), file=f)
					print(selection_method +"-"+ optimization +"-"+ modeling["model"] +"-"+ modeling["params"] +"-"+ VI_stat, file=f)
					print("FDR:  " +str(fdr_knock) + "%", file=f)
					print("power:  "+str(power_knock) + "%", file=f)
					# print(selection_method +"-"+ optimization +"-"+ modeling["model"] +"-"+ modeling["params"] +"-"+ VI_stat)

f.close()
Example #3
0
# adaboost method

selection_method = "DSS"

subsample = np.random.binomial(1, .5, size=n)
train_index = (subsample == 1)
valid_index = (subsample == 0)



w_train = model.fit(x[train_index, :], t[train_index].ravel()).feature_importances_.reshape(-1, 1)
w_valid = model.fit(x[valid_index, :], t[valid_index].ravel()).feature_importances_.reshape(-1, 1)

w_dss = np.vstack((w_train, w_valid))

DSS_selection = barber_candes_selection.BarberCandesSelection(modeling=modeling, selection_method=selection_method, q=q, w=w_dss).selection()

S_dss = DSS_selection.S
fdr_dss = 100*utils.FDR(S_dss, true_index)
power_dss = 100*utils.power(S_dss, true_index)

print('------------{} ({}, {})-------------'.format(selection_method, modeling["model"], modeling["params"]))
print("FDR:  " +str(fdr_dss) + "%")
print("power:  "+str(power_dss) + "%")



################################################################################################################
############################ knockoff selection
################################################################################################################