def sigmoid_activation(s, a, b): return sigmoid(a * s + b)
def test_sigmoid(value, expected): result = sigmoid(value) assert_array_almost_equal(result, expected, decimal=1)
XX = np.array([*bspl(tt)]) XX = ((XX - XX.min()) / XX.ptp()) * 2 - 1.0 XX[:, 0] = XX[:, 0] XX[:, 1] = XX[:, 1] XX[:, 2] = XX[:, 2] NN = N * 4 fig = plt.figure(figsize=(15, 15)) ax = fig.add_subplot(111, projection="3d") ax.grid(False) ax.axis(False) w = 1.0 b = 3.0 D = sigmoid(w * np.sqrt(XX[:, 0]**2) + b) dds = [] for i in range(NN - 1): x, y, z = XX[i:i + 2, 0], XX[i:i + 2, 1], XX[i:i + 2, 2] d = (sigmoid(w * np.sqrt(x[0]**2) + b) - D.min()) / D.ptp() dds.append(d) ax.plot(x, y, z, color=plt.cm.YlOrRd(int(255 * d)), lw=1) plt.tight_layout() plt.show() D = sigmoid(1.0 * np.sqrt(XX[:, 0]**2) + 3.0) dds = [] for i in range(NN - 1): x, y, z = XX[i:i + 2, 0], XX[i:i + 2, 1], XX[i:i + 2, 2] d = (sigmoid(1.0 * np.sqrt(x[0]**2) + 3.0) - D.min()) / D.ptp()