Beispiel #1
0
    def krigagemMatrix(self, colY, colX, colZ):

        self.X = list(self.matrix[colY, colX, colZ])
        testfun = testfunctions().squared
        self.y = testfun(self.X)
        self.k = kriging(self.X, self.y, testfunction=testfun, testPoints=300)

        self.k.train()
        self.k.snapshot()
Beispiel #2
0
def getTrainData():
    """获取训练数据"""
    X = io.getData(dataFilePath)
    Y = io.getData(labelsFilePath)

    return X, Y


# The Kriging model starts by defining a sampling plan, we use an optimal Latin Hypercube here
sp = samplingplan(3)
X = sp.optimallhc(30)

print("[DEBUG] X: {}".format(X))

# Next, we define the problem we would like to solve
testfun = testfunctions().squared
y = testfun(X)

# Now that we have our initial data, we can create an instance of a kriging model
k = kriging(X, y, testfunction=testfun, testPoints=300)

# The model is then trained
k.train()
k.snapshot()

# It's typically beneficial to add additional points based on the results of the initial training
# The infill method can be  used for this
# In this example, we will add nine points in three batches. The model gets trained after each stage
for i in range(10):
    print(k.history['rsquared'][-1])
    print('Infill iteration {0}'.format(i + 1))
Beispiel #3
0
import pyKriging
from pyKriging.krige import kriging
from pyKriging.samplingplan import samplingplan
from pyKriging.testfunctions import testfunctions


# The Kriging model starts by defining a sampling plan, we use an optimal Latin Hypercube here
sp = samplingplan(3)
X = sp.optimallhc(30)

# Next, we define the problem we would like to solve
testfun = testfunctions().squared
y = testfun(X)

# Now that we have our initial data, we can create an instance of a kriging model
k = kriging(X, y, testfunction=testfun, testPoints=300)

# The model is then trained
k.train()
k.snapshot()

# It's typically beneficial to add additional points based on the results of the initial training
# The infill method can be  used for this
# In this example, we will add nine points in three batches. The model gets trained after each stage
for i in range(10):
    print k.history['rsquared'][-1]
    print 'Infill iteration {0}'.format(i + 1)
    infillPoints = k.infill(10)

    # Evaluate the infill points and add them back to the Kriging model
    for point in infillPoints: