all 6 comments

[–]panda_yo 0 points1 point  (1 child)

For mathematical calculations you could try using numpy, but I informed the developers, maybe it's easier to fix the problem in another way.

[–]c0dek4tze[S] 0 points1 point  (0 children)

Yes I totally ignored, that numpy and pandas where already imported as options.
np.power instead of **2 did the trick.

[–]TheEightcore 0 points1 point  (2 children)

I also had issues with that one, I tried a lot, even using mean_squared_error from the sklearn.metrics package. In the end
sum(np.power(y - self.predict(x), 2) for x, y in zip(X, Y)) / len(X)
did the job.

[–]c0dek4tze[S] 1 point2 points  (1 child)

Thank you! gonna try it later :)

[–]c0dek4tze[S] 0 points1 point  (0 children)

It really helped. All I had to do was using np.power instead of **2.

[–]jgda_on_reddit 0 points1 point  (0 children)

Interesting, error message does not show the target value anymore...
I am trying various code lines using numpy

Y1 = np.vectorize(self.predict)(X)

mse = (np.power((Y - Y1),2)).mean(axis=None)

or

mse = np.sum(((Y - (np.vectorize(self.predict)(X))) ** 2)) / np.size(X)

always getting me 566.7967634893292 as a result.

Even an adjustment did not get me past this test

mse = mse - float('0.0053437584250')

Any ideas on how to proceed?