Error while running code of 0318_FeedForwardNetwork_new

sn = SigmoidNeuron(), Y_train, epochs=1000, learning_rate=0.5, display_loss=True)

TypeError: float() argument must be a string or a number, not ‘dict_values’

Please refer this:

1 Like
TypeError                                 Traceback (most recent call last)
<ipython-input-19-7ebf67954c13> in <module>()
      1 sn = SigmoidNeuron()
----> 2, Y_train, epochs=1000, learning_rate=0.5, display_loss=True))

TypeError: list() takes at most 1 argument (5 given)

Parameters of fit function should not be passed as list and so please replace as previous. That is,, Y_train, epochs = 1000, learning_rate = 0.5, display_loss = True)

Instead what has to be changed in the code is the following: Replace plt.plot(loss.values()) as
plt.plot(list(loss.values())) found within if condition of display loss.

I was facing the same issue, could you please tell me why we used the list() inside the plot function, was it only because of the error we were getting?

loss.values() is of type numpy array which probably used to work as argument to plot functionwell when the videos were made. (but doesn’t work now, version issues may be)
Converting it to python list, resolves the issue.

Edit/Note: loss.values() is of type numpy array: This statement about the ‘type’ needs verification. Though converting it to list will resolve the error for sure.

1 Like

While going through this notebook. I am not able to understand where to put list().

You need to put it inside the training loop, where you’re plotting loss and accuracy.

Could you please specify which line.

Have you executed the code, the error thrown will show you the line where the changes are required (if any).

Line 122, and 123 looks most likely.


It worked.

And In case, you want to discuss this new error, a new thread with appropriate subject line would be great :slight_smile:

1 Like

Duplicate of: