-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
Hi,
Thanks for sharing you work. I want to use the continuous entropy of your project in mine.
I have a matrice like this:
x = tf.Variable( [ [0.96, -0.65, 0.99, -0.1 ],
[0.97, 0.33, 0.25 , 0.05 ],
[0.9, 0.001, 0.009, 0.33 ],
[-0.60, -0.1, -0.3, -0.5 ],
[0.49, -0.8, -0.05, -0.0036],
[0.0 , -0.45, 0.087, 0.023 ],
[0.3, -0.23, 0.82, -0.28 ]])
When I apply the ee.entropy
, I receive this error:
rev = 1/ee.entropy(row)
File "/home/sgnbx/Downloads/NPEET/npeet/entropy_estimators.py", line 21, in entropy
assert k <= len(x) - 1, "Set k smaller than num. samples - 1"
TypeError: object of type 'Tensor' has no len()
This is my code:
def rev_entropy(x):
def row_entropy(row):
rev = 1/ee.entropy(row)
return rev
rev= tf.map_fn(row_entropy, x, dtype=tf.float32)
return rev
x = tf.Variable( [ [0.96, -0.65, 0.99, -0.1 ],
[0.97, 0.33, 0.25 , 0.05 ],
[0.9, 0.001, 0.009, 0.33 ],
[-0.60, -0.1, -0.3, -0.5 ],
[0.49, -0.8, -0.05, -0.0036],
[0.0 , -0.45, 0.087, 0.023 ],
[0.3, -0.23, 0.82, -0.28 ]])
p = (x + tf.abs(x)) / 2
ent_p = rev_entropy(p)
Can you please explain how can I know the `k` here?
print(ent_p)
Metadata
Metadata
Assignees
Labels
No labels