stephencwelch/Neural-Networks-Demystified

Something wrong with costfunction

Closed this issue · 6 comments

Hi Stephen, i watched your video about this code, very good by the way,
but when i tryed to implement i've got this error:

Traceback (most recent call last):
in computeNumericalGradient
numgrad[p] = (loss2 - loss1) / (2*e)
ValueError: setting an array element with a sequence.

and when i forked your code, the error persists, the costfunction shoud return a number? or am i wrog?

thank's,
Felipe Melo

Hmmm, I haven't come across this error when running the notebooks before - is numpy import properly? What is is the value of loss1 and loss2 in your notebook?

Dont worry man it was my mistake

Hey Felipe,
I am getting the same error, what was your fix?

Hi DandroidDeveloper

My problem was that i was not starting Y as matrix but as vector
so when i put: y = np.array(([75], [82], [93]), dtype=float) it solved

Hmmmm its still giving me problems, I'm building a net outside of ipython so that may be the issue... everything worked fine till the very last bit of the tutorial...

Stephenwelch

Any ideas why your code would throw this error only after the very last step of the seventh video, after making the changes to the costfunction and costfunctionprime methods?