Exemplo n.º 1
0
Arquivo: main.py Projeto: weiba/MOFGCN
 epochs = []
 true_data_s = pd.DataFrame()
 predict_data_s = pd.DataFrame()
 for fold in range(n_kfold):
     epoch, true_data, predict_data = mofgcn_new_target(
         gene=gene,
         cna=cna,
         mutation=mutation,
         drug_feature=feature_drug,
         response_mat=cell_drug,
         null_mask=null_mask,
         target_dim=dim,
         target_index=target_index,
         evaluate_fun=roc_auc,
         device="cuda:0")
     true_data_s = true_data_s.append(translate_result(true_data))
     predict_data_s = predict_data_s.append(
         translate_result(predict_data))
     epochs.append(epoch)
 if dim:
     file_drug.write(str(target_index) + ":" + str(epochs) + "\n")
     true_data_s.to_csv("./result_data/drug_" + str(target_index) +
                        "_true_data.csv")
     predict_data_s.to_csv("./result_data/drug_" + str(target_index) +
                           "_predict_data.csv")
 else:
     file_cell.write(str(target_index) + ":" + str(epochs) + "\n")
     true_data_s.to_csv("./result_data/cell_" + str(target_index) +
                        "_true_data.csv")
     predict_data_s.to_csv("./result_data/cell_" + str(target_index) +
                           "_predict_data.csv")
Exemplo n.º 2
0
                       n_hid2=64,
                       alpha=8.70,
                       device="cuda:0")
        opt = Optimizer(model,
                        sampler.train_data,
                        sampler.test_data,
                        sampler.test_mask,
                        sampler.train_mask,
                        roc_auc,
                        lr=1e-3,
                        epochs=1000,
                        device="cuda:0").to("cuda:0")
        epoch, true_data, predict_data = opt()

        epochs.append(epoch)
        true_datas = true_datas.append(translate_result(true_data))
        predict_datas = predict_datas.append(translate_result(predict_data))
file = open("./result_data/epochs.txt", "w")
file.write(str(epochs))
file.close()
pd.DataFrame(true_datas).to_csv("./result_data/true_data.csv")
pd.DataFrame(predict_datas).to_csv("./result_data/predict_data.csv")
"""
# 网格计算超参数,除alpha外
save_format = "{:^5d}{:^5d}{:^5d}{:^7d}{:^7d}{:7.2f}{:^9.5f}{:^9.4f}"
file = open("grid_result.txt", "w")

sigmas = [2, 3, 5, 7, 9]
knns = [2, 3, 5, 7, 9, 11]
iterates = [2, 3, 5, 7, 9]
n_hid1s = [36, 64, 128, 192]