|
@@ -137,15 +137,37 @@ def get_AUC(order_id):
|
|
# 保存图形为 PNG 文件
|
|
# 保存图形为 PNG 文件
|
|
plt.savefig(base_path + name + '.png')
|
|
plt.savefig(base_path + name + '.png')
|
|
|
|
|
|
- time.sleep(1)
|
|
|
|
- save_Variant_Type()
|
|
|
|
- time.sleep(1)
|
|
|
|
- save_Variant_Type2('t_ref_count', max_value=1000)
|
|
|
|
- time.sleep(1)
|
|
|
|
- save_Variant_Type2('t_alt_count', max_value=1000)
|
|
|
|
- time.sleep(1)
|
|
|
|
- save_Variant_Type2('t_depth', max_value=1000)
|
|
|
|
- time.sleep(1)
|
|
|
|
|
|
+ def save_end_data(self_prob_pre, name, pro_name): # 输出大于0.5的数据
|
|
|
|
+ second_column = self_prob_pre[:, 1]
|
|
|
|
+ # 找到大于0.5的数据的下标
|
|
|
|
+ indices = np.where(second_column >= 0.5)[0]
|
|
|
|
+ # print(144, pro_name, indices)
|
|
|
|
+
|
|
|
|
+ with open(f'{base_path}{name}.txt', 'w') as f:
|
|
|
|
+ for item in indices:
|
|
|
|
+ f.write("%s\n" % item)
|
|
|
|
+ #
|
|
|
|
+ # # 绘制折线图
|
|
|
|
+ # # plt.plot(second_column)
|
|
|
|
+ # plt.plot(indices, second_column[indices], 'ro')
|
|
|
|
+ # # 设置 x 轴和 y 轴标签
|
|
|
|
+ # plt.title(f"{pro_name} Probability prediction greater than 0.5")
|
|
|
|
+ # plt.xlabel("Index")
|
|
|
|
+ # plt.ylabel("Value")
|
|
|
|
+ # # 保存图像
|
|
|
|
+ # plt.savefig(f"{base_path}{name}概率预测.png", format="png")
|
|
|
|
+ # # 清除图像
|
|
|
|
+ # plt.clf()
|
|
|
|
+
|
|
|
|
+ # time.sleep(1)
|
|
|
|
+ # save_Variant_Type()
|
|
|
|
+ # time.sleep(1)
|
|
|
|
+ # save_Variant_Type2('t_ref_count', max_value=1000)
|
|
|
|
+ # time.sleep(1)
|
|
|
|
+ # save_Variant_Type2('t_alt_count', max_value=1000)
|
|
|
|
+ # time.sleep(1)
|
|
|
|
+ # save_Variant_Type2('t_depth', max_value=1000)
|
|
|
|
+ # time.sleep(1)
|
|
# 绘制图像
|
|
# 绘制图像
|
|
# plt.imshow(data['t_depth'])
|
|
# plt.imshow(data['t_depth'])
|
|
# 保存为图片文件
|
|
# 保存为图片文件
|
|
@@ -204,6 +226,19 @@ def get_AUC(order_id):
|
|
plt.imshow(prob_pre)
|
|
plt.imshow(prob_pre)
|
|
# 保存为图片文件
|
|
# 保存为图片文件
|
|
plt.savefig(base_path + "SC_GRS_prob_pre.png", format='png')
|
|
plt.savefig(base_path + "SC_GRS_prob_pre.png", format='png')
|
|
|
|
+ # second_column = prob_pre[1, :]
|
|
|
|
+ # # 找到大于0.5的数据的下标
|
|
|
|
+ # indices = np.where(second_column > 0.5)
|
|
|
|
+ # # 绘制折线图
|
|
|
|
+ # plt.plot(second_column)
|
|
|
|
+ # plt.plot(indices, second_column[indices], 'ro')
|
|
|
|
+ # # 设置 x 轴和 y 轴标签
|
|
|
|
+ # plt.title('SC GRS Probability prediction greater than 0.5')
|
|
|
|
+ # plt.xlabel('Index')
|
|
|
|
+ # plt.ylabel('Value')
|
|
|
|
+ # # 显示图形
|
|
|
|
+ # plt.savefig(base_path + "GRS概率预测.png", format='png')
|
|
|
|
+ save_end_data(prob_pre, 'SC_GRS', 'SC GRS')
|
|
|
|
|
|
# -------------------------------------DL_GRS方法-----------------------------------------
|
|
# -------------------------------------DL_GRS方法-----------------------------------------
|
|
# 模型训练
|
|
# 模型训练
|
|
@@ -231,7 +266,7 @@ def get_AUC(order_id):
|
|
plt.imshow(prob_pre)
|
|
plt.imshow(prob_pre)
|
|
# 保存为图片文件
|
|
# 保存为图片文件
|
|
plt.savefig(base_path + "DL_GRS_prob_pre.png", format='png')
|
|
plt.savefig(base_path + "DL_GRS_prob_pre.png", format='png')
|
|
-
|
|
|
|
|
|
+ save_end_data(prob_pre, 'DL_GRS', 'DL GRS')
|
|
# -------------------------------------OR_GRS方法-----------------------------------------
|
|
# -------------------------------------OR_GRS方法-----------------------------------------
|
|
# or值计算
|
|
# or值计算
|
|
tempdata = data_final[data_final['D'] == 0]
|
|
tempdata = data_final[data_final['D'] == 0]
|
|
@@ -265,10 +300,12 @@ def get_AUC(order_id):
|
|
X_test = (data_final[gene_list] * omega_or).sum(axis=1).values.reshape(-1, 1)
|
|
X_test = (data_final[gene_list] * omega_or).sum(axis=1).values.reshape(-1, 1)
|
|
y_pre = clf.predict(X_test) # 分类结果预测
|
|
y_pre = clf.predict(X_test) # 分类结果预测
|
|
prob_pre = clf.predict_proba(X_test) # 结果概率预测
|
|
prob_pre = clf.predict_proba(X_test) # 结果概率预测
|
|
|
|
+
|
|
# 绘制图像
|
|
# 绘制图像
|
|
plt.imshow(prob_pre)
|
|
plt.imshow(prob_pre)
|
|
# 保存为图片文件
|
|
# 保存为图片文件
|
|
plt.savefig(base_path + "OR_GRS_prob_pre.png", format='png')
|
|
plt.savefig(base_path + "OR_GRS_prob_pre.png", format='png')
|
|
|
|
+ save_end_data(prob_pre, 'OR_GRS', 'OR GRS')
|
|
# logger.info(154, prob_pre)
|
|
# logger.info(154, prob_pre)
|
|
# 更新order状态
|
|
# 更新order状态
|
|
try:
|
|
try:
|