Skip to content

Instantly share code, notes, and snippets.

@GypsyDangerous
Created April 4, 2019 15:57
Show Gist options
  • Save GypsyDangerous/72721440c7cbdebee35ee4314eb6aa0d to your computer and use it in GitHub Desktop.
Save GypsyDangerous/72721440c7cbdebee35ee4314eb6aa0d to your computer and use it in GitHub Desktop.
EnergeticDimMap created by anonymous - https://repl.it/repls/EnergeticDimMap
import numpy as np
import random
def round(x):
large = int(x+1)
if large-x <= .5:
return large
else:
return int(x)
def round_array(x):
for i in range(len(x)):
x[i] = round(x[i])
def softmax(x):
return np.exp(x) / np.sum(np.exp(x))
def percent(x, val=100):
if val == 100:
return x
else:
return ((x*100)/val)
def truncate(x, val=100):
return int(x*100)/val
test = np.random.rand(5, 1)
test = softmax(test)
print(test)
test = percent(test, 1)
# round_array(test)
print(test)
print(np.sum(test))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment