capaulson / pyKriging

Welcome to the User Friendly Python Kriging Toolbox!
http://www.pykriging.com
MIT License
382 stars 113 forks source link

errors in simple kriging prediction attempt #13

Closed florakarniav closed 7 years ago

florakarniav commented 7 years ago

Hello, I am trying to perform a simple kriging prediction. My training data are of form: X 2.0, 10.0 3.0, 10.0 5.0, 15.0 .. and

Y 67.8 79.6 89.3 ..

the simple code I run is the following:

k = kriging(X, y, testPoints=10)
k.train()
k_predictions = k.predict(X)
print k_predictions

I keep getting the following errors: krige.py:85: RuntimeWarning: invalid value encountered in double_scalars X[i] = (X[i] - self.normRange[i][0]) / float(self.normRange[i][1] - self.normRange[i][0]) matrixops.py:46: RuntimeWarning: invalid value encountered in absolute self.LnDetPsi=2*np.sum(np.log(np.abs(np.diag(self.U)))) krige.py:85: RuntimeWarning: divide by zero encountered in true_divide X[i] = (X[i] - self.normRange[i][0]) / float(self.normRange[i][1] - self.normRange[i][0])

and naturally, k_predictions is nan.

Can someone help or point me to the right direction? Thank you in advance

capaulson commented 7 years ago

Strange. Are there any duplicate points in your data?

Best, Chris

capaulson commented 7 years ago

I haven't seen any response to this come through. I'll close it for now, but feel free to reopen if you're still having issues with this.

natertott commented 5 years ago

I was having a similar issue when I tried kriging to points lying in a straight line. For example, if I used the coordinate system

X = [1, 0.4] [1, 0.8] [1, 1.2]

then I received the same "invalid value encountered in double_scalars" message. Changing any one of the coordinates even slightly, such as X = [1.1, 0.4] [1, 0.8] [1, 1.2]

resolved the problem.