Skip to content

Commit 42aa485

Browse files
author
Tomasz Latkowski
committed
added Fisher selection method
1 parent 2a6c350 commit 42aa485

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

selection.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import tensorflow as tf
2+
3+
4+
def fisher(data, num_instances: list, top_k=10):
5+
class1, class2 = tf.split(data, num_instances)
6+
mean1, std1 = tf.nn.moments(class1, axes=0)
7+
mean2, std2 = tf.nn.moments(class2, axes=0)
8+
fisher_coeffs = (mean1 - mean2) / (std1 + std2)
9+
return tf.nn.top_k(fisher_coeffs, k=top_k)
10+

0 commit comments

Comments
 (0)