This document summarizes a research paper that proposes a novel method for estimating predictive confidence in deep neural networks based on density modelling. It discusses issues with using the softmax function alone to estimate confidence, such as the confidence increasing with the L2 norm of the input. The proposed method models the density distribution of activations for each class and applies Bayes' rule to obtain confidence estimates. Experiments on MNIST and ImageNet datasets show the proposed method produces confidence estimates that decrease more gracefully than softmax as distortions are applied to images, like noise, blurring and compression.
13. tf.reduce_mean
tf.reduce_mean
tf.reduce_mean example
x = np.array([[1,2,3],
[4,5,6],
[7,8,9]])
a = tf.reduce_mean(x,axis=0) [4 5 6]
a = tf.reduce_mean(x,axis=1) [2 5 8]
a = tf.reduce_mean(x) 5
x = np.array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
x = np.array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
4 5 6
2
5
8
case 1 : axis=0
case 2 : axis=1
14. tf.assign
tf.assign
覲 襦 螳 麹蠍 .
Example 1
a = tf.Variable(initial_value=3, dtype = tf.float32)
b = tf.assign(a,1) or a.assign(1)
sess = tf.Session()
sess.run(tf.global_variables_initializer())
print(sess.run(a)) 3.0
print(sess.run(b)) 1.0
print(sess.run(a)) 1.0
15. How to load and save data
np.loadtxt(filename, dtype, delimiter, skiprows)
Example
import numpy as np
np.loadtxt(".../data.csv", delimiter=',', dtype=np.float32)
# skiprows = n 蟆曙, n覯讌 譴蟾讌 誤螻 覿.
np.savetxt(filename, X, delimiter)
Example
import numpy as np
a = np.array([[1,2,3],[4,5,6],[7,8,9]])
np.savetxt(".../data.csv", a, delimiter=',')
19. Hypothesis : linear function
Prediction : 豸♀ 0.5覲企 襯 蠍一朱 class label 蟆一
magic.csv 殊 一危磯ゼ 曙 4/5襯 training set朱 螻 襾語 1/5 test set朱
, training set朱 linear classification test set accuracy襯 蟲
襴壱誤 貊襯 燕.
Step 企至 れ伎 test set accuracy襯 詞 讌 螻ろ伎 .
豢螻殊1 (10 25手讌 豢) linear hypothesis 伎 classification
20. Hypothesis : logistic function
Prediction : 豸♀ 0.5覲企 襯 蠍一朱 class label 蟆一
magic.csv 殊 一危磯ゼ 曙 4/5襯 training set朱 螻 襾語 1/5 test set朱
, training set朱 logistic classification test set accuracy襯 蟲
襴壱誤 貊襯 燕.
Step 企至 れ伎 test set accuracy襯 詞 讌 螻ろ伎 .
magic.csv : Data are MC generated to simulate registration of high energy gamma particles in
an atmospheric Cherenkov telescope
instance 19020螳, feature: 10螳, class: 2螳
豢螻殊2 (10 25手讌 豢) logistic classification
21. Lab06 殊企 貊襯 谿瑚 image.csv 殊 一危磯ゼ 曙 4/5襯 training set朱
螻 襾語 1/5 test set朱, training set朱 softmax classification
test set 襯 襴壱誤 貊襯 燕.
Step 企至 れ伎 test set accuracy襯 詞 讌 螻ろ伎 .
magic.csv : 殊 企語 一危磯 覯暑覃, , , 覃, 谿, 蟆暑, 襯 企
企る 企伎
instance 2310螳, feature: 19螳, class: 7螳
豢螻殊3 (10 25手讌 豢) softmax classification