定义一系列变量
library(tidyr)
df %>%
separate_rows(ALT,AF,AC,EAS_AF,AMR_AF,AFR_AF,EUR_AF,SAS_AF, convert=TRUE)
CHROM POS ID REF AN consequence gene accession gene_type ALT AF AC EAS_AF AMR_AF AFR_AF
1 10 180109 rs547699134 G 5008 synonymous_variant ZMYND11 NM_006624.5 protein_coding A 0.000199681 1 0.001 0.0000 0.0000
2 10 209892 rs151111729 C 5008 stop_gained ZMYND11 NM_006624.5 protein_coding G 0.003194890 16 0.000 0.0000 0.0121
3 10 221335 rs143013573 C 5008 synonymous_variant ZMYND11 NM_006624.5 protein_coding G 0.024361000 122 0.000 0.0043 0.0900
4 10 221335 rs143013573 C 5008 synonymous_variant ZMYND11 NM_006624.5 protein_coding T 0.004792330 24 0.000 0.0014 0.0000
5 10 239445 rs145483680 G 5008 synonymous_variant ZMYND11 NM_006624.5 protein_coding A 0.004392970 22 0.000 0.0014 0.0159
6 10 246927 rs547339499 A 5008 synonymous_variant ZMYND11 NM_006624.5 protein_coding G 0.000798722 4 0.000 0.0000 0.0030
7 10 246928 rs72770983 A 5008 synonymous_variant ZMYND11 NM_006624.5 protein_coding G 0.002396170 12 0.001 0.0014 0.0000
8 10 246933 rs1431845 G 5008 synonymous_variant ZMYND11 NM_006624.5 protein_coding A 0.220248000 1103 0.248 0.1599 0.1611
9 10 246955 rs556577288 C 5008 synonymous_variant ZMYND11 NM_006624.5 protein_coding T 0.000998403 5 0.000 0.0000 0.0000
10 10 246970 rs575589407 A 5008 synonymous_variant ZMYND11 NM_006624.5 protein_coding G 0.000199681 1 0.000 0.0014 0.0000
EUR_AF SAS_AF
1 0.0000 0.0000
2 0.0000 0.0000
3 0.0000 0.0000
4 0.0089 0.0143
5 0.0000 0.0000
6 0.0000 0.0000
7 0.0089 0.0010
8 0.2495 0.2843
9 0.0000 0.0051
10 0.0000 0.0000
用给定的损失函数训练模型"损失",然后计算上面变量的Hessian,
a_v = tf.Variable([20.2], tf.float32)
a_s = tf.Variable([18.0], tf.float32)
...
给予Hessian的回忆
hess = tf.hessians( loss , [a_v,...] )
只出现Hessian的对角线部分,而不是整个Hessian矩阵。
理论上,tensorflow manual函数应该支持"支持评估Hessian关于(一系列)一维张量"。