(x)
| 52 | return x * (1 - x) if derivative else 1 / (1 + np.exp(-x)) |
| 53 | |
| 54 | def softmax(x): |
| 55 | scoreMatExp = np.exp(np.asarray(x)) |
| 56 | return scoreMatExp / scoreMatExp.sum(0) |
| 57 | |
| 58 | clut = [(0, 0, 0), (255, 0, 0), (255, 0, 255), (0, 0, 255), (0, 255, 0), |
| 59 | (0, 255, 128), (128, 255, 0), (128, 128, 0), (0, 128, 255), |