关于EeepOI指标及CCL指标验证
Posted Mario cai
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于EeepOI指标及CCL指标验证相关的知识,希望对你有一定的参考价值。
将fprint进行排序
n=1
data_fprint = np.load(fr'D:\\DEPOI\\npy_data\\n\\fprintn.npy', allow_pickle=True)
x,y = data_fprint.shape
# print((data_fprint[5] == data_fprint[88]).all())
print(x,y)
count=[]
z=-1
while z <= 1297 :
z = z+1
for i in range(z, x):
if((data_fprint[z] == data_fprint[i]).all()):
count.append(i)
print(z)
record = pd.DataFrame(count) # predictive real
record.to_csv(fr'D:\\DEPOI\\npy_data\\n\\fprintn.csv', index=False)
当模型输出结果之后,寻找fprint与sample进行匹配。
例子是用预测值和fprint匹配。
# n =2
# df = pd.read_csv(fr'D:\\DEPOI\\npy_data\\n\\fprintn.csv',encoding='gbk')
# test = pd.read_csv(fr'D:\\DEPOI\\npy_data\\n\\crossn_pred.csv',encoding='gbk')
#
# df = np.array(df)
# test = np.array(test)
#
# test = np.transpose(test,(1,0))
# # df = np.transpose(df,(1,0))
#
#
# # print(test[0][df[1][1]])
# x,y = df.shape
# print(df[0])
# print(x,y)
# count = []
# T=[]
# print(test[0][1297])
#
#
# for j in range(0,x):
# # for i in range(0, y):
# # print(test[0][df[x][i]])
# # t = test[0][df[x][i]]
# # print(df[x][i])
# # print(df[j])
# t = np.array(test[0][df[j]])
# # print(i,j)
#
# # print(t)
# # T.append(t)
# # break
#
#
# count.append(t)
#
# # #
# count = np.array(count)
# record = pd.DataFrame(count) # predictive real
# record.to_csv(fr'D:\\DEPOI\\npy_data\\n\\n_pred.csv', index=False)
匹配完成之后将模型输出的结果切割成基因形状Deepoi=1298
n=2
df = pd.read_csv(fr'D:\\DEPOI\\npy_data\\n\\n_pred.csv',encoding='gbk')
T = np.array(df.real)
T = np.array_split(T,1298)
# T = sum(T)
record = pd.DataFrame(T) # predictive real
record.to_csv(fr'D:\\DEPOI\\npy_data\\n\\ttt.csv', index=False)
P = np.array(df.pred)
P = np.array_split(P,1298)
# P = sum(P)
record1 = pd.DataFrame(P) # predictive real
record1.to_csv(fr'D:\\DEPOI\\npy_data\\n\\ppp.csv', index=False)
r,p = stats.pearsonr(T,P)## 相关系数和P值
print('相关系数r为 = %6.3f,p值为 = %6.3f'%(r,p))
输出为两个表格之后,利用np.transpose进行翻转测试。
n=2
P = pd.read_csv(fr'D:\\DEPOI\\npy_data\\n\\ppp.csv')
T = pd.read_csv(fr'D:\\DEPOI\\npy_data\\n\\ttt.csv')
P = np.array(P)
T = np.array(T)
# P = np.transpose(P,(1,0))
# T = np.transpose(T,(1,0))
x,y = P.shape
print(x,y)
count = []
t = []
p = []
# print(T[1])
for j in range(0,x):
r,pp = stats.pearsonr(T[j],P[j])## 相关系数和P值
count.append(r)
#
count = np.array(count)
record = pd.DataFrame(count) # predictive real
record.to_csv(fr'D:\\DEPOI\\npy_data\\n\\deepoi4.csv', index=False)
以上是关于关于EeepOI指标及CCL指标验证的主要内容,如果未能解决你的问题,请参考以下文章
R语言临床预测模型的评价指标与验证指标实战:C-index指标计算
R语言临床预测模型的评价指标与验证指标实战:自定义的综合判别改善指标(Integrated Discrimination Improvement, IDI)函数