-2

I came across these lines of code in machine learning using python.

z = np.linspace(-10, 10, 100)
# Compute sigmoid  Activation function
A_sigmoid, z = sigmoid(z)

Please, what is line three saying? Basically, I want to know how to separate 2 inputs with a comma on the lefthand side. A_sigmoid was never predefined.

Thank you.

z = np.linspace(-10, 10, 100)
# Compute sigmoid  Activation function
A_sigmoid, z = sigmoid(z)
juanpa.arrivillaga
  • 88,713
  • 10
  • 131
  • 172
moski
  • 61
  • 8
  • It is _unpacking_ a tuple response into individual names. That _is_ the definition of `A_sigmoid` (in terms of defining it in your code, not that that name or this particular example is special in any way) – roganjosh Jul 10 '19 at 15:57

1 Answers1

1
>>> t = (1, 2)  # define a tuple
>>> a, b = t  # unpack it
>>> print(a)
1
>>> print(b)
2

Note that a,b = t where t = (1, 2) is the same as doing (a, b) = (1, 2).

math.husky
  • 193
  • 1
  • 8