Applying a function along a numpy array : <p>I've the following numpy ndarray.</p>

<pre><code>[ -0.54761371  17.04850603   4.86054302]
</code></pre>

<p>I want to apply this function to all elements of the array</p>

<pre><code>def sigmoid(x):
  return 1 / (1 + math.exp(-x))

probabilities = np.apply_along_axis(sigmoid, -1, scores)
</code></pre>

<p>This is the error that I get.</p>

<pre><code>TypeError: only length-1 arrays can be converted to Python scalars
</code></pre>

<p>What am I doing wrong.</p>
