1818import math as m
1919
2020
21+
2122class kriging (matrixops ):
2223 def __init__ (self , X , y , testfunction = None , name = '' , testPoints = None , ** kwargs ):
2324 self .X = copy .deepcopy (X )
@@ -36,7 +37,7 @@ def __init__(self, X, y, testfunction=None, name='', testPoints=None, **kwargs):
3637 self .updateData ()
3738 self .updateModel ()
3839
39- self .thetamin = 1e-4
40+ self .thetamin = 1e-5
4041 self .thetamax = 100
4142 self .pmin = 1
4243 self .pmax = 2
@@ -51,6 +52,7 @@ def __init__(self, X, y, testfunction=None, name='', testPoints=None, **kwargs):
5152 self .history ['adjrsquared' ] = [0 ]
5253 self .history ['chisquared' ] = [1000 ]
5354 self .history ['lastPredictedPoints' ] = []
55+ self .history ['avgMSE' ] = []
5456 if testPoints :
5557 self .history ['pointData' ] = []
5658 self .testPoints = self .sp .rlh (testPoints )
@@ -116,10 +118,10 @@ def normalizeData(self):
116118 for i in range (self .k ):
117119 self .normRange .append ([min (self .X [:, i ]), max (self .X [:, i ])])
118120
119- print self .X
121+ # print self.X
120122 for i in range (self .n ):
121123 self .X [i ] = self .normX (self .X [i ])
122- print self .X
124+ # print self.X
123125
124126 self .ynormRange .append (min (self .y ))
125127 self .ynormRange .append (max (self .y ))
@@ -688,6 +690,8 @@ def snapshot(self):
688690 self .history ['theta' ].append (copy .deepcopy (self .theta ))
689691 self .history ['p' ].append (copy .deepcopy (self .pl ))
690692
693+ self .history ['avgMSE' ].append (self .calcuatemeanMSE (points = self .testPoints )[0 ])
694+
691695 currentPredictions = []
692696 if self .history ['pointData' ]!= None :
693697 for pointprim in self .history ['pointData' ]:
0 commit comments