implementing entropy, cross entropy