Comments (9)
Hi Michael,
Sorry that the examples aren't clear. I've included a bare-bones example below that attempts to show how to use pyKriging. The X array represents an array of vectors where observations are made, while the y array holds the corresponding scalar for each observed point. Once a Kriging model is initialized with the observed data, you need to train the model (k.train()). Training the model establishes the hyperparameters for the model. Once trained, you can query the model (k.predict()) or plot the result.
Does this help?
Best,
Chris
import numpy as np
from pyKriging import kriging
X = np.array([[ 0.75, 0.15],
[ 0.55, 0.95],
[ 0.15, 0.25],
[ 0.25, 0.85],
[ 0.05, 0.65],
[ 0.35, 0.45],
[ 0.45, 0.05],
[ 0.85, 0.75],
[ 0.65, 0.55],
[ 0.95, 0.35]])
y = np.array( [0.865, 0.325, 0.085, 0.065 ,0.125, 0.325, 0.925, 1.145, 1.325, 0.9025] )
k = kriging(X, y)
k.train()
print k.predict([.25,.25])
k.plot()
from pykriging.
Thanks for getting back too me, I have been using pykrige for awhile and there are some performance issues with the newest version, so now I am back testing your library. The example ran perfectly and so I tried extending it to my data. I followed the example with my 2225 measurements and I get the following exception
File "C:\Users\mwallace\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyKriging\krige.py", line 145, in updateModel
raise Exception("bad params")
Exception: bad params
Also do you have any doc on the inputs to k.plot and kriging?
from pykriging.
Hmmm... If I had to guess (without seeing the data), you have two identical points or two points that are very close to each other. This causes issues in matrix calculations. Could you share data?
from pykriging.
I removed all the points that where less than a meter apart from each other and then executed the code again. No luck still get bad params error. Attached is a csv with the 3 columns of data.
setup grid
xmin=np.min(x)
xmax=np.max(x)
ymin=np.min(y)
ymax=np.max(y)
dx=(xmax-xmin)
dy=(ymax-ymin)
gridy = np.arange(0, dy, dy/100.0)
gridx = np.arange(0, dx, dx/100.0)
grid=np.vstack((gridx,gridy)).T
from example in this thread
k = kriging(pos, z)
k.train()
znew=k.predict(grid)
k.plot()
Sincerely,
Michael Wallace
from pykriging.
Michael,
Thank you for sharing the data. This issue was fairly obvious. I believe it should be addressed by this commit:
I'm running the model right now, but it is taking a while. I'll report back once I get it trained to verify that it worked.
Best,
Chris
from pykriging.
Michael,
I wanted to follow up with results. To save time on training, I reduced the point count to 500 randomly selected points. The included plot shows the results. The upper left is a contour plot of the prediction, upper right is the predicted MSE, the lower plot is a 3D plot of the prediction model.
from pykriging.
This is the Kriging model with all the data:
from pykriging.
Thanks this is great and looks really good and its in the same color scale I use daily.
I figured out how to update my system and then I tried running the code. Performance on my computer is slow even when I decimate the data. I was unable to get past the training step (no error) just killed the process because it had been running for too long (over an hour for the big set). It is interesting though to compare the decimated to undecimated data. It says I don't need that dense of data to get a decent interpretation.
Your observation about overlapping points was also helpful because it gave me a way to filter all the data for overlap instead of just clusters. I think I need to use a compiled library like gslib, surfer win32com events, qgis or sage possibly.
I think I will use pyKrigging for another application where there is less and sparser data. Thanks capaulson for the help and being responsive.
Sincerely,
Michael Wallace
from pykriging.
why not have more detailed documentation!
from pykriging.
Related Issues (20)
- Documentation for your library HOT 1
- Prediction with multiple inputs HOT 4
- It starts to predict the same value as I increase sample number to predict HOT 3
- How could I output the predicted array as a numpy array? HOT 2
- Regression Kriging not able to use the optimizer option when called from MATLAB HOT 1
- How to save the result as picture HOT 4
- How to save the trained Kriging Model? HOT 1
- PyKriging Documentation HOT 1
- n-dimensional Kriging HOT 1
- How do I save the trained model? HOT 1
- Optimizer of krige and regressionkrige HOT 1
- How the code works? What is sp, X, y and testfun? HOT 1
- Regression kringe HOT 1
- How to save the trained model for later recall?
- N dimension kriging model
- the problem of k.plot()
- -
- How to use Cokriging algorithm? HOT 3
- The website could not be visited? HOT 2
- CoKiging HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pykriging.