- Timestamp:
- 09/10/12 07:35:06 (4 years ago)
- Location:
- branches/UQ/math/legacy
- Files:
-
- 1 added
- 1 deleted
- 6 edited
- 2 copied
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/UQ/math/legacy/MINMAX_StAlData.py
r546 r556 4 4 MINMAX = -1 ## NOTE: sup = maximize = -1; inf = minimize = 1 5 5 ####################################################################### 6 # scaling and mpi info; also optimizer configuration parameters 7 # hard-wired: use DE solver, don't use mpi, F-F' calculation 6 # optimizer configuration parameters 8 7 ####################################################################### 9 8 npop = 20 #40 #!!! … … 16 15 17 16 ####################################################################### 18 # the model function and the dataset 19 ####################################################################### 20 #from StAlSurrogate import st_al_surr as model 17 # the dataset 18 ####################################################################### 21 19 from legacydata import load_dataset 22 20 data = load_dataset('StAlDataset.txt') … … 150 148 ####################################################################### 151 149 if __name__ == '__main__': 152 #function_name = model.__name__153 150 dataset_name = data.__name__ 154 151 … … 164 161 _n = _npts(npts) 165 162 166 # FIXME: check units versus those in model andin dataset163 #XXX: check units versus those in dataset 167 164 w_lower = [0.0]; Y_lower = [0.0] 168 165 w_upper = [1.0]; Y_upper = [100.0] … … 189 186 print "..............\n" 190 187 191 #print " model: f(x) = %s(x)" % function_name192 188 print " data: z = {%s}" % dataset_name 193 189 print " target: %s" % str(target) -
branches/UQ/math/legacy/MM_OUQ_StAlData.py
r546 r556 10 10 MINMAX = -1 ## NOTE: sup = maximize = -1; inf = minimize = 1 11 11 ####################################################################### 12 # scaling and mpi info; also optimizer configuration parameters 13 # hard-wired: use DE solver, don't use mpi, F-F' calculation 12 # optimizer configuration parameters 14 13 ####################################################################### 15 14 npop = 32 #!!! … … 22 21 23 22 ####################################################################### 24 # the model function and the dataset 25 ####################################################################### 26 #from StAlSurrogate import st_al_surr as model 23 # the dataset 24 ####################################################################### 27 25 from legacydata import load_dataset 28 26 data = load_dataset('StAlDataset.txt') … … 111 109 # check mean value, and if necessary use constrain to set mean value 112 110 y = float(mean(c.values, c.weights)) 113 if not (y >= float(target[0])): #XXX: or target[0]-error[0] ? 114 #c.values = impose_mean(target[0]+target[1], c.values, c.weights) 111 if not (y >= float(target[0] - error[0])): 115 112 c.update( constrain( c.flatten(all=True) ) ) 116 113 … … 127 124 if not [sum(w) for w in c.wts] == [1.0] * len(c.wts): 128 125 print "norm(w) == 1.0: False" 129 if not c.get_mean_value() >= target[0]: 130 print "mean(y) >= %s: False"#%s" % (target[0], c.get_mean_value() \ 131 # >= target[0]) 126 if not c.get_mean_value() >= float(target[0] - error[0]): 127 print "mean(y) >= %s: False" % str(target[0] - error[0]) 132 128 ###################### end function-specific ###################### 133 129 # extract weights and positions and values … … 146 142 ##################### begin function-specific ##################### 147 143 y = float(mean(c.values, c.weights)) 148 if not (y >= float(target[0] )):144 if not (y >= float(target[0] - error[0])): 149 145 if debug: print "skipping mean: %s" % y 150 146 return inf #XXX: FORCE TO SATISFY E CONSTRAINTS … … 176 172 ####################################################################### 177 173 if __name__ == '__main__': 178 #function_name = model.__name__179 174 dataset_name = data.__name__ 180 181 #model_tol = 2.0 #expect difference is in [-1.677, 1.507], where 2 > |-1.677|182 175 183 176 from mystic.math.measures import mean 184 177 # y_mean = mean(data.values) 185 178 y_mean = 11.0 #NOTE: SET THE 'mean' HERE! 186 y_ error = 0.0001 #NOTE: SET THE 'error' HERE!179 y_mean_error = 0.0001 #NOTE: SET THE 'error' HERE! 187 180 theta = 7.0 #NOTE: SET THE 'failure criteria' HERE! 188 181 short_tol = 1e-9 #NOTE: SET THE 'short tolerance' HERE! 189 target = (y_mean,theta,None); error = (y_ error,None,short_tol)182 target = (y_mean,theta,None); error = (y_mean_error,None,short_tol) 190 183 pars = (target,error) 191 184 … … 197 190 _n = _npts(npts) 198 191 199 # FIXME: check units versus those in model andin dataset192 #XXX: check units versus those in dataset 200 193 w_lower = [0.0]; Y_lower = [0.0] 201 194 w_upper = [1.0]; Y_upper = [100.0] … … 205 198 206 199 #XXX XXX: EDITED TO USE w_split 207 #lower_bounds = (nx * w_lower) + (nx * h_lower) \208 # + (ny * w_lower) + (ny * a_lower) \209 # + (nz * w_lower) + (nz * v_lower) \210 200 lower_bounds = (w_lower) + (w_split) + (nx * h_lower) \ 211 201 + (w_lower) + (w_split) + (ny * a_lower) \ 212 202 + (w_lower) + (w_split) + (nz * v_lower) \ 213 203 + (_n * Y_lower) 214 #upper_bounds = (nx * w_upper) + (nx * h_upper) \215 # + (ny * w_upper) + (ny * a_upper) \216 # + (nz * w_upper) + (nz * v_upper) \217 204 upper_bounds = (w_split) + (w_upper) + (nx * h_upper) \ 218 205 + (w_split) + (w_upper) + (ny * a_upper) \ … … 230 217 print "..............\n" 231 218 232 #print " model: f(x) = %s(x)" % function_name233 219 print " data: z = {%s}" % dataset_name 234 220 print " target: %s" % str(target) … … 277 263 print "fails short wrt data:\n%s" % c.short_wrt_data(data, tol=short_tol,\ 278 264 blamelist=True) 279 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean )265 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean - y_mean_error) 280 266 print "sum_wts: %s == 1.0" % [sum(w) for w in c.wts] 281 267 -
branches/UQ/math/legacy/TEST_OUQ_1dData.py
r546 r556 8 8 MINMAX = -1 ## NOTE: sup = maximize = -1; inf = minimize = 1 9 9 ####################################################################### 10 # scaling and mpi info; also optimizer configuration parameters 11 # hard-wired: use DE solver, don't use mpi, F-F' calculation 10 # optimizer configuration parameters 12 11 ####################################################################### 13 12 npop = 32 #!!! … … 20 19 21 20 ####################################################################### 22 # the model function and the dataset 23 ####################################################################### 24 #from StAlSurrogate import st_al_surr as model 21 # the dataset 22 ####################################################################### 25 23 from legacydata import load_dataset 26 24 data = load_dataset('ExampleDataset.txt', range(0,1)) … … 107 105 # check mean value, and if necessary use constrain to set mean value 108 106 y = float(mean(c.values, c.weights)) 109 if not (y >= float(target[0])): #XXX: or target[0]-error[0] ? 110 #c.values = impose_mean(target[0]+target[1], c.values, c.weights) 107 if not (y >= float(target[0] - error[0])): 111 108 c.update( constrain( c.flatten(all=True) ) ) 112 109 … … 123 120 if not [sum(w) for w in c.wts] == [1.0] * len(c.wts): 124 121 print "norm(w) == 1.0: False" 125 if not c.get_mean_value() >= target[0]: 126 print "mean(y) >= %s: False"#%s" % (target[0], c.get_mean_value() \ 127 # >= target[0]) 122 if not c.get_mean_value() >= float(target[0] - error[0]): 123 print "mean(y) >= %s: False" % str(target[0] - error[0]) 128 124 ###################### end function-specific ###################### 129 125 # extract weights and positions and values … … 142 138 ##################### begin function-specific ##################### 143 139 y = float(mean(c.values, c.weights)) 144 if not (y >= float(target[0] )):140 if not (y >= float(target[0] - error[0])): 145 141 if debug: print "skipping mean: %s" % y 146 142 return inf #XXX: FORCE TO SATISFY E CONSTRAINTS … … 172 168 ####################################################################### 173 169 if __name__ == '__main__': 174 #function_name = model.__name__175 170 dataset_name = data.__name__ 176 177 #model_tol = 2.0 #expect difference is in [-1.677, 1.507], where 2 > |-1.677|178 171 179 172 from mystic.math.measures import mean 180 173 # y_mean = mean(data.values) 181 174 y_mean = 0.5 #NOTE: SET THE 'mean' HERE! 182 y_ error = 0.0001 #NOTE: SET THE 'error' HERE!175 y_mean_error = 0.0001 #NOTE: SET THE 'error' HERE! 183 176 theta = 0.0 #NOTE: SET THE 'failure criteria' HERE! 184 177 short_tol = 1e-9 #NOTE: SET THE 'short tolerance' HERE! 185 target = (y_mean,theta,None); error = (y_ error,None,short_tol)178 target = (y_mean,theta,None); error = (y_mean_error,None,short_tol) 186 179 pars = (target,error) 187 180 … … 193 186 _n = _npts(npts) 194 187 195 # FIXME: check units versus those in model andin dataset188 #XXX: check units versus those in dataset 196 189 w_lower = [0.0]; Y_lower = [0.0] 197 190 w_upper = [1.0]; Y_upper = [1.0] … … 201 194 202 195 #XXX XXX: EDITED TO USE w_split *AND* npts=(2,1,1) *AND* FIX Y1 == Y_lower 203 #lower_bounds = (nx * w_lower) + (nx * h_lower) \204 # + (ny * w_lower) + (ny * a_lower) \205 # + (nz * w_lower) + (nz * v_lower) \206 196 lower_bounds = (w_lower) + (w_split) + (nx * h_lower) \ 207 197 + (ny * w_upper) + (ny * a_lower) \ 208 198 + (nz * w_upper) + (nz * v_lower) \ 209 199 + (_n * Y_lower) 210 #upper_bounds = (nx * w_upper) + (nx * h_upper) \211 200 upper_bounds = (w_split) + (w_upper) + (nx * h_upper) \ 212 201 + (ny * w_upper) + (ny * a_upper) \ 213 202 + (nz * w_upper) + (nz * v_upper) \ 214 203 + (Y_lower) + (Y_upper) 215 # + (_n * Y_upper)216 204 bounds = (lower_bounds,upper_bounds) 217 205 … … 225 213 print "..............\n" 226 214 227 #print " model: f(x) = %s(x)" % function_name228 215 print " data: z = {%s}" % dataset_name 229 216 print " target: %s" % str(target) … … 272 259 print "fails short wrt data:\n%s" % c.short_wrt_data(data, tol=short_tol,\ 273 260 blamelist=True) 274 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean )261 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean - y_mean_error) 275 262 print "sum_wts: %s == 1.0" % [sum(w) for w in c.wts] 276 263 -
branches/UQ/math/legacy/TEST_OUQ_1dSurr_CxCy.py
r552 r556 2 2 """ 3 3 OUQ with model sausage: valid_wrt_model, mean(y), norm(wts) 4 with lipschitz and bounds from ExampleDataset4 with 'wiggle room' from full sausage around the model 5 5 """ 6 6 7 debug = True#False7 debug = False 8 8 MINMAX = -1 ## NOTE: sup = maximize = -1; inf = minimize = 1 9 9 ####################################################################### 10 # scaling and mpi info; also optimizer configuration parameters 11 # hard-wired: use DE solver, don't use mpi, F-F' calculation 12 ####################################################################### 13 npop = 20 #20 #40 #!!! 10 # optimizer configuration parameters 11 ####################################################################### 12 npop = 10 #15 #20 #32 #40 #!!! 14 13 maxiter = 1000 15 14 maxfun = 1e+6 … … 20 19 21 20 ####################################################################### 22 # the model function and the dataset 23 ####################################################################### 24 #from StAlSurrogate import st_al_surr as model 25 #from legacydata import load_dataset 26 #data = load_dataset('ExampleDataset.txt', range(0,1)) 27 #L = data.lipschitz 28 29 def model(x): 30 return x[0]; 21 # the model function 22 ####################################################################### 23 def model(x): return x[0] 24 31 25 32 26 ####################################################################### … … 110 104 # check mean value, and if necessary use constrain to set mean value 111 105 y = float(mean(c.values, c.weights)) 112 if not (y >= float(target[0] )): #XXX: or target[0]-error[0] ?106 if not (y >= float(target[0] - error[0])): 113 107 c.update( constrain( c.flatten(all=True) ) ) 114 108 115 109 # then test if valid... then impose model validity on product measure 116 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3]): 110 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3], \ 111 maxiter=error[4]): 117 112 c.set_valid(model, cutoff=target[2], bounds=bounds, tol=error[2], \ 118 constraints=constrain, xtol=target[3])113 constraints=constrain, xtol=target[3], imax=target[4]) 119 114 ###################### more function-specific ##################### 120 115 if debug: 121 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3]): 116 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3], \ 117 maxiter=error[4]): 122 118 print "valid_wrt_model: False" 123 119 if not [sum(w) for w in c.wts] == [1.0] * len(c.wts): 124 120 print "norm(w) == 1.0: False" 125 if not c.get_mean_value() >= target[0]:126 print "mean(y) >= %s: False" 121 if not c.get_mean_value() >= float(target[0] - error[0]): 122 print "mean(y) >= %s: False" % str(target[0] - error[0]) 127 123 ###################### end function-specific ###################### 128 124 # extract weights and positions and values … … 141 137 ##################### begin function-specific ##################### 142 138 y = float(mean(c.values, c.weights)) 143 if not (y >= float(target[0] )):139 if not (y >= float(target[0] - error[0])): 144 140 if debug: print "skipping mean: %s" % y 145 141 return inf #XXX: FORCE TO SATISFY E CONSTRAINTS 146 142 147 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3]): 143 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3], \ 144 maxiter=error[4]): 148 145 if debug: print "skipping model-invalidity" 149 146 return inf #XXX: FORCE TO SATISFY E CONSTRAINTS … … 168 165 if __name__ == '__main__': 169 166 function_name = model.__name__ 170 #dataset_name = data.__name__171 167 172 168 from mystic.math.measures import mean … … 174 170 y_mean_error = 0.0 #NOTE: SET THE 'error' HERE! 175 171 theta = 0.0 #NOTE: SET THE 'failure criteria' HERE! 176 Cy = 1.0 #NOTE: SET THE 'cutoff' HERE! 177 Cx = (0.0,0.0,0.0) #NOTE: SET THE 'wiggle' HERE! 178 valid_tol = 1.e-6 #NOTE: SET THE 'model tolerance' HERE! 179 target = (y_mean,theta,Cy,Cx); error = (y_mean_error,None,valid_tol,None) 172 Cy = 0.1 #NOTE: SET THE 'cutoff' HERE! 173 Cx = (2.0,0.0,0.0) #NOTE: SET THE 'wiggle' HERE! 174 valid_tol = 0.0 #NOTE: SET THE 'model tolerance' HERE! 175 iter = 200 #NOTE: SET THE 'Cy-validation maxiter' HERE! 176 imax = 10 #NOTE: SET THE 'Cx-validation maxiter' HERE! 177 target = (y_mean,theta,Cy,Cx,imax) 178 error = (y_mean_error,None,valid_tol,None,iter) 180 179 pars = (target,error) 181 180 … … 187 186 _n = _npts(npts) 188 187 189 # FIXME: check units versus those in model and in dataset188 #XXX: check units versus those in model 190 189 w_lower = [0.0]; Y_lower = [theta] 191 w_upper = [1.0]; Y_upper = [ 5.0]190 w_upper = [1.0]; Y_upper = [10.0] 192 191 h_lower = [0.0]; a_lower = [0.0]; v_lower = [0.0] 193 192 h_upper = [1.0]; a_upper = [0.0]; v_upper = [0.0] 194 w_split = [0.5] 195 196 #XXX XXX: EDITED TO USE w_split *AND* npts=(2,1,1) *AND* FIX Y1 == Y_lower 197 #lower_bounds = (nx * w_lower) + (nx * h_lower) \ 198 # + (ny * w_lower) + (ny * a_lower) \ 199 # + (nz * w_lower) + (nz * v_lower) \ 200 lower_bounds = (w_lower) + (w_split) + (nx * h_lower) \ 201 + (ny * w_upper) + (ny * a_lower) \ 202 + (nz * w_upper) + (nz * v_lower) \ 203 + (_n * Y_lower) 204 #upper_bounds = (nx * w_upper) + (nx * h_upper) \ 205 upper_bounds = (w_split) + (w_upper) + (nx * h_upper) \ 193 194 #XXX XXX: EDITED TO USE npts=(2,1,1) *AND* FIX Y1 == Y_lower 195 lower_bounds = (nx * w_lower) + (nx * h_lower) \ 196 + (ny * w_lower) + (ny * a_lower) \ 197 + (nz * w_lower) + (nz * v_lower) \ 198 + (_n * Y_lower) 199 upper_bounds = (nx * w_upper) + (nx * h_upper) \ 206 200 + (ny * w_upper) + (ny * a_upper) \ 207 201 + (nz * w_upper) + (nz * v_upper) \ 208 + (Y_lower) + (Y_upper) 209 # + (_n * Y_upper) 202 + (Y_lower) + (Y_upper) 210 203 bounds = (lower_bounds,upper_bounds) 211 204 … … 220 213 221 214 print " model: f(x) = %s(x)" % function_name 222 #print " lipschitz constant: L = %s" % L223 215 print " target: %s" % str(target) 224 216 print " error: %s" % str(error) … … 262 254 #print "solved: %s" % str( c.flatten(all=True) ) 263 255 264 print "fails valid wrt model:\n%s" % c.valid_wrt_model(model, xtol=Cx,\265 tol=Cy, blamelist=True)266 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean )256 print "fails valid wrt model:\n%s" % \ 257 c.valid_wrt_model(model, xtol=Cx, tol=Cy, blamelist=True, maxiter=iter) 258 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean - y_mean_error) 267 259 print "sum_wts: %s == 1.0" % [sum(w) for w in c.wts] 268 260 261 from paramtrans import graphical_distance 262 Ry = graphical_distance(model, c, tol=Cy, xtol=Cx, cutoff=0.0, maxiter=0) 263 print "vertical_distance: %s <= %s" % (Ry, Cy + max(Cx)) 264 Rv = graphical_distance(model, c, tol=Cy, xtol=Cx, cutoff=0.0, maxiter=iter) 265 print "graphical_distance: %s <= %s" % (Rv, Cy) 266 269 267 # EOF -
branches/UQ/math/legacy/TEST_OUQ_1dSurr_Cy.py
r552 r556 2 2 """ 3 3 OUQ with model sausage: valid_wrt_model, mean(y), norm(wts) 4 with lipschitz and bounds from ExampleDataset4 with 'wiggle room' around the model in Y 5 5 """ 6 6 7 debug = True#False7 debug = False 8 8 MINMAX = -1 ## NOTE: sup = maximize = -1; inf = minimize = 1 9 9 ####################################################################### 10 # scaling and mpi info; also optimizer configuration parameters 11 # hard-wired: use DE solver, don't use mpi, F-F' calculation 12 ####################################################################### 13 npop = 20 #20 #40 #!!! 10 # optimizer configuration parameters 11 ####################################################################### 12 npop = 40 #!!! 14 13 maxiter = 1000 15 14 maxfun = 1e+6 … … 20 19 21 20 ####################################################################### 22 # the model function and the dataset 23 ####################################################################### 24 #from StAlSurrogate import st_al_surr as model 25 #from legacydata import load_dataset 26 #data = load_dataset('ExampleDataset.txt', range(0,1)) 27 #L = data.lipschitz 28 29 def model(x): 30 return x[0]; 21 # the model function 22 ####################################################################### 23 def model(x): return x[0] 24 31 25 32 26 ####################################################################### … … 110 104 # check mean value, and if necessary use constrain to set mean value 111 105 y = float(mean(c.values, c.weights)) 112 if not (y >= float(target[0] )): #XXX: or target[0]-error[0] ?106 if not (y >= float(target[0] - error[0])): 113 107 c.update( constrain( c.flatten(all=True) ) ) 114 108 115 109 # then test if valid... then impose model validity on product measure 116 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3]): 110 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3], \ 111 maxiter=error[4]): 117 112 c.set_valid(model, cutoff=target[2], bounds=bounds, tol=error[2], \ 118 constraints=constrain, xtol=target[3])113 constraints=constrain, xtol=target[3], imax=target[4]) 119 114 ###################### more function-specific ##################### 120 115 if debug: 121 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3]): 116 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3], \ 117 maxiter=error[4]): 122 118 print "valid_wrt_model: False" 123 119 if not [sum(w) for w in c.wts] == [1.0] * len(c.wts): 124 120 print "norm(w) == 1.0: False" 125 if not c.get_mean_value() >= target[0]:126 print "mean(y) >= %s: False" 121 if not c.get_mean_value() >= float(target[0] - error[0]): 122 print "mean(y) >= %s: False" % str(target[0] - error[0]) 127 123 ###################### end function-specific ###################### 128 124 # extract weights and positions and values … … 141 137 ##################### begin function-specific ##################### 142 138 y = float(mean(c.values, c.weights)) 143 if not (y >= float(target[0] )):139 if not (y >= float(target[0] - error[0])): 144 140 if debug: print "skipping mean: %s" % y 145 141 return inf #XXX: FORCE TO SATISFY E CONSTRAINTS 146 142 147 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3]): 143 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3], \ 144 maxiter=error[4]): 148 145 if debug: print "skipping model-invalidity" 149 146 return inf #XXX: FORCE TO SATISFY E CONSTRAINTS … … 168 165 if __name__ == '__main__': 169 166 function_name = model.__name__ 170 #dataset_name = data.__name__171 167 172 168 from mystic.math.measures import mean … … 174 170 y_mean_error = 0.0 #NOTE: SET THE 'error' HERE! 175 171 theta = 0.0 #NOTE: SET THE 'failure criteria' HERE! 176 Cy = 1.0#NOTE: SET THE 'cutoff' HERE!172 Cy = 0.1 #NOTE: SET THE 'cutoff' HERE! 177 173 Cx = (0.0,0.0,0.0) #NOTE: SET THE 'wiggle' HERE! 178 valid_tol = 1.e-6 #NOTE: SET THE 'model tolerance' HERE! 179 target = (y_mean,theta,Cy,Cx); error = (y_mean_error,None,valid_tol,None) 174 valid_tol = 0.0 #NOTE: SET THE 'model tolerance' HERE! 175 iter = 200 #NOTE: SET THE 'Cy-validation maxiter' HERE! 176 imax = 10 #NOTE: SET THE 'Cx-validation maxiter' HERE! 177 target = (y_mean,theta,Cy,Cx,imax) 178 error = (y_mean_error,None,valid_tol,None,iter) 180 179 pars = (target,error) 181 180 … … 187 186 _n = _npts(npts) 188 187 189 # FIXME: check units versus those in model and in dataset188 #XXX: check units versus those in model 190 189 w_lower = [0.0]; Y_lower = [theta] 191 w_upper = [1.0]; Y_upper = [ 5.0]190 w_upper = [1.0]; Y_upper = [10.0] 192 191 h_lower = [0.0]; a_lower = [0.0]; v_lower = [0.0] 193 192 h_upper = [1.0]; a_upper = [0.0]; v_upper = [0.0] 194 w_split = [0.5] 195 196 #XXX XXX: EDITED TO USE w_split *AND* npts=(2,1,1) *AND* FIX Y1 == Y_lower 197 #lower_bounds = (nx * w_lower) + (nx * h_lower) \ 198 # + (ny * w_lower) + (ny * a_lower) \ 199 # + (nz * w_lower) + (nz * v_lower) \ 200 lower_bounds = (w_lower) + (w_split) + (nx * h_lower) \ 201 + (ny * w_upper) + (ny * a_lower) \ 202 + (nz * w_upper) + (nz * v_lower) \ 203 + (_n * Y_lower) 204 #upper_bounds = (nx * w_upper) + (nx * h_upper) \ 205 upper_bounds = (w_split) + (w_upper) + (nx * h_upper) \ 193 194 #XXX XXX: EDITED TO USE npts=(2,1,1) *AND* FIX Y1 == Y_lower 195 lower_bounds = (nx * w_lower) + (nx * h_lower) \ 196 + (ny * w_lower) + (ny * a_lower) \ 197 + (nz * w_lower) + (nz * v_lower) \ 198 + (_n * Y_lower) 199 upper_bounds = (nx * w_upper) + (nx * h_upper) \ 206 200 + (ny * w_upper) + (ny * a_upper) \ 207 201 + (nz * w_upper) + (nz * v_upper) \ 208 + (Y_lower) + (Y_upper) 209 # + (_n * Y_upper) 202 + (Y_lower) + (Y_upper) 210 203 bounds = (lower_bounds,upper_bounds) 211 204 … … 220 213 221 214 print " model: f(x) = %s(x)" % function_name 222 #print " lipschitz constant: L = %s" % L223 215 print " target: %s" % str(target) 224 216 print " error: %s" % str(error) … … 262 254 #print "solved: %s" % str( c.flatten(all=True) ) 263 255 264 print "fails valid wrt model:\n%s" % c.valid_wrt_model(model, xtol=Cx,\265 tol=Cy, blamelist=True)266 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean )256 print "fails valid wrt model:\n%s" % \ 257 c.valid_wrt_model(model, xtol=Cx, tol=Cy, blamelist=True, maxiter=iter) 258 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean - y_mean_error) 267 259 print "sum_wts: %s == 1.0" % [sum(w) for w in c.wts] 268 260 261 from paramtrans import graphical_distance 262 Ry = graphical_distance(model, c, tol=Cy, xtol=Cx, cutoff=0.0, maxiter=0) 263 print "vertical_distance: %s <= %s" % (Ry, Cy + max(Cx)) 264 Rv = graphical_distance(model, c, tol=Cy, xtol=Cx, cutoff=0.0, maxiter=iter) 265 print "graphical_distance: %s <= %s" % (Rv, Cy) 266 269 267 # EOF -
branches/UQ/math/legacy/TEST_OUQ_StAlData.py
r546 r556 8 8 MINMAX = -1 ## NOTE: sup = maximize = -1; inf = minimize = 1 9 9 ####################################################################### 10 # scaling and mpi info; also optimizer configuration parameters 11 # hard-wired: use DE solver, don't use mpi, F-F' calculation 10 # optimizer configuration parameters 12 11 ####################################################################### 13 12 npop = 32 #!!! … … 20 19 21 20 ####################################################################### 22 # the model function and the dataset 23 ####################################################################### 24 #from StAlSurrogate import st_al_surr as model 21 # the dataset 22 ####################################################################### 25 23 from legacydata import load_dataset 26 24 data = load_dataset('StAlDataset.txt') … … 107 105 # check mean value, and if necessary use constrain to set mean value 108 106 y = float(mean(c.values, c.weights)) 109 if not (y >= float(target[0])): #XXX: or target[0]-error[0] ? 110 #c.values = impose_mean(target[0]+target[1], c.values, c.weights) 107 if not (y >= float(target[0] - error[0])): 111 108 c.update( constrain( c.flatten(all=True) ) ) 112 109 … … 123 120 if not [sum(w) for w in c.wts] == [1.0] * len(c.wts): 124 121 print "norm(w) == 1.0: False" 125 if not c.get_mean_value() >= target[0]: 126 print "mean(y) >= %s: False"#%s" % (target[0], c.get_mean_value() \ 127 # >= target[0]) 122 if not c.get_mean_value() >= float(target[0] - error[0]): 123 print "mean(y) >= %s: False" % str(target[0] - error[0]) 128 124 ###################### end function-specific ###################### 129 125 # extract weights and positions and values … … 142 138 ##################### begin function-specific ##################### 143 139 y = float(mean(c.values, c.weights)) 144 if not (y >= float(target[0] )):140 if not (y >= float(target[0] - error[0])): 145 141 if debug: print "skipping mean: %s" % y 146 142 return inf #XXX: FORCE TO SATISFY E CONSTRAINTS … … 172 168 ####################################################################### 173 169 if __name__ == '__main__': 174 #function_name = model.__name__175 170 dataset_name = data.__name__ 176 177 #model_tol = 2.0 #expect difference is in [-1.677, 1.507], where 2 > |-1.677|178 171 179 172 from mystic.math.measures import mean 180 173 # y_mean = mean(data.values) 181 174 y_mean = 11.0 #NOTE: SET THE 'mean' HERE! 182 y_ error = 0.0001 #NOTE: SET THE 'error' HERE!175 y_mean_error = 0.0001 #NOTE: SET THE 'error' HERE! 183 176 theta = 7.0 #NOTE: SET THE 'failure criteria' HERE! 184 177 short_tol = 1e-9 #NOTE: SET THE 'short tolerance' HERE! 185 target = (y_mean,theta,None); error = (y_ error,None,short_tol)178 target = (y_mean,theta,None); error = (y_mean_error,None,short_tol) 186 179 pars = (target,error) 187 180 … … 193 186 _n = _npts(npts) 194 187 195 # FIXME: check units versus those in model andin dataset188 #XXX: check units versus those in dataset 196 189 w_lower = [0.0]; Y_lower = [0.0] 197 190 w_upper = [1.0]; Y_upper = [100.0] … … 201 194 202 195 #XXX XXX: EDITED TO USE w_split 203 #lower_bounds = (nx * w_lower) + (nx * h_lower) \204 # + (ny * w_lower) + (ny * a_lower) \205 # + (nz * w_lower) + (nz * v_lower) \206 196 lower_bounds = (w_lower) + (w_split) + (nx * h_lower) \ 207 197 + (w_lower) + (w_split) + (ny * a_lower) \ 208 198 + (w_lower) + (w_split) + (nz * v_lower) \ 209 199 + (_n * Y_lower) 210 #upper_bounds = (nx * w_upper) + (nx * h_upper) \211 # + (ny * w_upper) + (ny * a_upper) \212 # + (nz * w_upper) + (nz * v_upper) \213 200 upper_bounds = (w_split) + (w_upper) + (nx * h_upper) \ 214 201 + (w_split) + (w_upper) + (ny * a_upper) \ … … 226 213 print "..............\n" 227 214 228 #print " model: f(x) = %s(x)" % function_name229 215 print " data: z = {%s}" % dataset_name 230 216 print " target: %s" % str(target) … … 273 259 print "fails short wrt data:\n%s" % c.short_wrt_data(data, tol=short_tol,\ 274 260 blamelist=True) 275 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean )261 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean - y_mean_error) 276 262 print "sum_wts: %s == 1.0" % [sum(w) for w in c.wts] 277 263 -
branches/UQ/math/legacy/TEST_OUQ_StStSurr_Cy.py
r552 r556 2 2 """ 3 3 OUQ with model sausage: valid_wrt_model, mean(y), norm(wts) 4 with lipschitz and bounds from ExampleDataset4 with 'wiggle room' around the model in Y 5 5 """ 6 6 7 debug = True#False7 debug = False 8 8 MINMAX = -1 ## NOTE: sup = maximize = -1; inf = minimize = 1 9 9 ####################################################################### 10 # scaling and mpi info; also optimizer configuration parameters 11 # hard-wired: use DE solver, don't use mpi, F-F' calculation 12 ####################################################################### 13 npop = 20 #20 #40 #!!! 10 # optimizer configuration parameters 11 ####################################################################### 12 npop = 40 #50 #!!! 14 13 maxiter = 1000 15 14 maxfun = 1e+6 … … 20 19 21 20 ####################################################################### 22 # the model function and the dataset 23 ####################################################################### 24 #from StAlSurrogate import st_al_surr as model 25 #from legacydata import load_dataset 26 #data = load_dataset('ExampleDataset.txt', range(0,1)) 27 #L = data.lipschitz 28 29 def model(x): 30 return x[0]; 21 # the model function 22 ####################################################################### 23 from StStSurrogate import marc_surr as model 24 31 25 32 26 ####################################################################### … … 110 104 # check mean value, and if necessary use constrain to set mean value 111 105 y = float(mean(c.values, c.weights)) 112 if not (y >= float(target[0] )): #XXX: or target[0]-error[0] ?106 if not (y >= float(target[0] - error[0])): 113 107 c.update( constrain( c.flatten(all=True) ) ) 114 108 115 109 # then test if valid... then impose model validity on product measure 116 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3]): 110 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3], \ 111 maxiter=error[4]): 117 112 c.set_valid(model, cutoff=target[2], bounds=bounds, tol=error[2], \ 118 constraints=constrain, xtol=target[3])113 constraints=constrain, xtol=target[3], imax=target[4]) 119 114 ###################### more function-specific ##################### 120 115 if debug: 121 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3]): 116 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3], \ 117 maxiter=error[4]): 122 118 print "valid_wrt_model: False" 123 119 if not [sum(w) for w in c.wts] == [1.0] * len(c.wts): 124 120 print "norm(w) == 1.0: False" 125 if not c.get_mean_value() >= target[0]:126 print "mean(y) >= %s: False" 121 if not c.get_mean_value() >= float(target[0] - error[0]): 122 print "mean(y) >= %s: False" % str(target[0] - error[0]) 127 123 ###################### end function-specific ###################### 128 124 # extract weights and positions and values … … 141 137 ##################### begin function-specific ##################### 142 138 y = float(mean(c.values, c.weights)) 143 if not (y >= float(target[0] )):139 if not (y >= float(target[0] - error[0])): 144 140 if debug: print "skipping mean: %s" % y 145 141 return inf #XXX: FORCE TO SATISFY E CONSTRAINTS 146 142 147 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3]): 143 if not c.valid_wrt_model(model, tol=target[2], xtol=target[3], \ 144 maxiter=error[4]): 148 145 if debug: print "skipping model-invalidity" 149 146 return inf #XXX: FORCE TO SATISFY E CONSTRAINTS … … 168 165 if __name__ == '__main__': 169 166 function_name = model.__name__ 170 #dataset_name = data.__name__171 167 172 168 from mystic.math.measures import mean 173 y_mean = 0.5#NOTE: SET THE 'mean' HERE!174 y_mean_error = 0.0 #NOTE: SET THE 'error' HERE!175 theta = 0.0 #NOTE: SET THE 'failure criteria' HERE!176 Cy = 1.0#NOTE: SET THE 'cutoff' HERE!169 y_mean = 6.5 #NOTE: SET THE 'mean' HERE! 170 y_mean_error = 1.0 #NOTE: SET THE 'error' HERE! 171 theta = 5.0 #NOTE: SET THE 'failure criteria' HERE! 172 Cy = 0.05 #NOTE: SET THE 'cutoff' HERE! 177 173 Cx = (0.0,0.0,0.0) #NOTE: SET THE 'wiggle' HERE! 178 valid_tol = 1.e-6 #NOTE: SET THE 'model tolerance' HERE! 179 target = (y_mean,theta,Cy,Cx); error = (y_mean_error,None,valid_tol,None) 174 valid_tol = 0.0 #NOTE: SET THE 'model tolerance' HERE! 175 iter = 200 #NOTE: SET THE 'Cy-validation maxiter' HERE! 176 imax = 10 #NOTE: SET THE 'Cx-validation maxiter' HERE! 177 target = (y_mean,theta,Cy,Cx,imax) 178 error = (y_mean_error,None,valid_tol,None,iter) 180 179 pars = (target,error) 181 180 … … 187 186 _n = _npts(npts) 188 187 189 # FIXME: check units versus those in model and in dataset188 #XXX: check units versus those in model 190 189 w_lower = [0.0]; Y_lower = [theta] 191 w_upper = [1.0]; Y_upper = [5.0] 192 h_lower = [0.0]; a_lower = [0.0]; v_lower = [0.0] 193 h_upper = [1.0]; a_upper = [0.0]; v_upper = [0.0] 194 w_split = [0.5] 195 196 #XXX XXX: EDITED TO USE w_split *AND* npts=(2,1,1) *AND* FIX Y1 == Y_lower 197 #lower_bounds = (nx * w_lower) + (nx * h_lower) \ 198 # + (ny * w_lower) + (ny * a_lower) \ 199 # + (nz * w_lower) + (nz * v_lower) \ 200 lower_bounds = (w_lower) + (w_split) + (nx * h_lower) \ 201 + (ny * w_upper) + (ny * a_lower) \ 202 + (nz * w_upper) + (nz * v_lower) \ 203 + (_n * Y_lower) 204 #upper_bounds = (nx * w_upper) + (nx * h_upper) \ 205 upper_bounds = (w_split) + (w_upper) + (nx * h_upper) \ 190 w_upper = [1.0]; Y_upper = [100.0] 191 h_lower = [60.0]; a_lower = [0.0]; v_lower = [2.1] 192 h_upper = [105.0]; a_upper = [30.0]; v_upper = [2.8] 193 194 #XXX XXX: EDITED TO USE npts=(2,1,1) *AND* FIX Y1 == Y_lower 195 lower_bounds = (nx * w_lower) + (nx * h_lower) \ 196 + (ny * w_lower) + (ny * a_lower) \ 197 + (nz * w_lower) + (nz * v_lower) \ 198 + (_n * Y_lower) 199 upper_bounds = (nx * w_upper) + (nx * h_upper) \ 206 200 + (ny * w_upper) + (ny * a_upper) \ 207 201 + (nz * w_upper) + (nz * v_upper) \ 208 + (Y_lower) + (Y_upper) 209 # + (_n * Y_upper) 202 + (Y_lower) + (Y_upper) 210 203 bounds = (lower_bounds,upper_bounds) 211 204 … … 220 213 221 214 print " model: f(x) = %s(x)" % function_name 222 #print " lipschitz constant: L = %s" % L223 215 print " target: %s" % str(target) 224 216 print " error: %s" % str(error) … … 262 254 #print "solved: %s" % str( c.flatten(all=True) ) 263 255 264 print "fails valid wrt model:\n%s" % c.valid_wrt_model(model, xtol=Cx,\265 tol=Cy, blamelist=True)266 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean )256 print "fails valid wrt model:\n%s" % \ 257 c.valid_wrt_model(model, xtol=Cx, tol=Cy, blamelist=True, maxiter=iter) 258 print "mean(y): %s >= %s" % (str( c.get_mean_value() ), y_mean - y_mean_error) 267 259 print "sum_wts: %s == 1.0" % [sum(w) for w in c.wts] 268 260 261 from paramtrans import graphical_distance 262 Ry = graphical_distance(model, c, tol=Cy, xtol=Cx, cutoff=0.0, maxiter=0) 263 print "vertical_distance: %s <= %s" % (Ry, Cy + max(Cx)) 264 Rv = graphical_distance(model, c, tol=Cy, xtol=Cx, cutoff=0.0, maxiter=iter) 265 print "graphical_distance: %s <= %s" % (Rv, Cy) 266 269 267 # EOF -
branches/UQ/math/legacy/dirac_measure.py
r547 r556 1012 1012 1013 1013 # construct and configure optimizer 1014 debug = False #!!!1014 debug = True#False #!!! 1015 1015 maxiter = 1000; maxfun = 1e+6 1016 1016 crossover = 0.9; percent_change = 0.9 … … 1028 1028 if debug: stepmon = VerboseMonitor(10) #!!! 1029 1029 if npop: # use VTR 1030 _i = 2 #XXX: iter returned as results[2] 1030 1031 results = diffev2(cost, guess, npop, ftol=ftol, gtol=gtol, bounds=bounds,\ 1031 1032 maxiter=maxiter, maxfun=maxfun, constraints=constraints,\ … … 1034 1035 full_output=1, disp=0, handler=False) 1035 1036 else: # use VTR 1037 _i = 3 #XXX: iter returned as results[3] (results[2] == direc) 1036 1038 results = fmin_powell(cost, guess, ftol=ftol, gtol=gtol, bounds=bounds,\ 1037 1039 maxiter=maxiter, maxfun=maxfun, constraints=constraints,\ … … 1042 1044 pm.load(results[0], pts) # params: w,x,y 1043 1045 if debug: print "final cost: %s" % results[1] 1044 if debug and results[ 2] >= maxiter: # iterations1046 if debug and results[_i] >= maxiter: # iterations 1045 1047 print "Warning: constraints solver terminated at maximum iterations" 1046 #func_evals = results[ 3]# evaluation1048 #func_evals = results[_i+1] # evaluation 1047 1049 return pm 1048 1050 … … 1118 1120 xtol = 0.0 # default 1119 1121 if kwds.has_key('xtol'): xtol = kwds['xtol'] 1120 npop = 20 # XXX: tune npop (outer optimization)?1122 npop = 20 #None #XXX: tune npop (outer optimization)? 1121 1123 if kwds.has_key('npop'): npop = kwds.pop('npop') 1124 maxiter = 50 #XXX: tune maxiter (outer optimization)? 1125 if kwds.has_key('maxiter'): maxiter = kwds.pop('maxiter') 1122 1126 # tolerance for optimization on sum(y) 1123 1127 tol = 0.0 # default 1124 1128 if kwds.has_key('tol'): tol = kwds.pop('tol') 1125 ipop = None#XXX: tune npop (inner optimization)?1129 ipop = 10 #XXX: tune npop (inner optimization)? 1126 1130 if kwds.has_key('ipop'): ipop = kwds.pop('ipop') 1131 imax = 10 #XXX: tune maxiter (inner optimization)? 1132 if kwds.has_key('imax'): imax = kwds.pop('imax') 1127 1133 1128 1134 # if no guess was made, then use bounds constraints … … 1141 1147 points.load(rv, pts) 1142 1148 # calculate infeasibility 1143 Rv = graphical_distance(model, points, tol=cutoff, npop=ipop, **kwds) 1149 Rv = graphical_distance(model, points, tol=cutoff, npop=ipop, \ 1150 maxiter=imax, **kwds) 1144 1151 v = infeasibility(Rv, cutoff) 1145 1152 # converting v to E … … 1148 1155 # construct and configure optimizer 1149 1156 debug = False #!!! 1150 max iter = 1000; maxfun = 1e+61157 maxfun = 1e+6 1151 1158 crossover = 0.9; percent_change = 0.8 1152 ftol = abs(tol); gtol = None 1159 ftol = abs(tol); gtol = None #XXX: optimally, should be VTRCOG... 1153 1160 1154 1161 if debug: … … 1161 1168 from mystic.strategy import Best1Bin, Best1Exp 1162 1169 evalmon = Monitor(); stepmon = Monitor(); strategy = Best1Exp 1163 if debug: stepmon = VerboseMonitor( 1) #!!!1170 if debug: stepmon = VerboseMonitor(2) #!!! 1164 1171 if npop: # use VTR 1172 _i = 2 #XXX: iter returned as results[2] 1165 1173 results = diffev2(cost, guess, npop, ftol=ftol, gtol=gtol, bounds=bounds,\ 1166 1174 maxiter=maxiter, maxfun=maxfun, constraints=constraints,\ … … 1169 1177 full_output=1, disp=0, handler=False) 1170 1178 else: # use VTR 1179 _i = 3 #XXX: iter returned as results[3] (results[2] == direc) 1171 1180 results = fmin_powell(cost, guess, ftol=ftol, gtol=gtol, bounds=bounds,\ 1172 1181 maxiter=maxiter, maxfun=maxfun, constraints=constraints,\ … … 1177 1186 pm.load(results[0], pts) # params: w,x,y 1178 1187 #if debug: print "final cost: %s" % results[1] 1179 if debug and results[ 2] >= maxiter: # iterations1188 if debug and results[_i] >= maxiter: # iterations 1180 1189 print "Warning: constraints solver terminated at maximum iterations" 1181 #func_evals = results[ 3]# evaluation1190 #func_evals = results[_i+1] # evaluation 1182 1191 return pm 1183 1192 -
branches/UQ/math/legacy/paramtrans.py
r547 r556 337 337 if cutoff: cutoff = tol 338 338 else: cutoff = None 339 npop = min(20, 4*nxi) #XXX: tune npop?339 npop = min(20, 3*nxi) #XXX: tune npop? 340 340 if kwds.has_key('npop'): npop = kwds.pop('npop') 341 imax = 1000 #XXX: tune maxiter? 342 if kwds.has_key('maxiter'): imax = kwds.pop('maxiter') 341 343 342 344 ######################################################################### 343 def radius(model, point, tol=0.0, xtol=0.0, npop=None ):345 def radius(model, point, tol=0.0, xtol=0.0, npop=None, maxiter=None): 344 346 """graphical distance between a single point x,y and a model F(x')""" 345 347 # given a single point x,y: find the radius = |y - F(x')| … … 359 361 360 362 if debug: 361 print "rv: %s" % x363 print "rv: %s" % str(x) 362 364 print "cost: %s" % cost(x) 363 365 364 if not xtol: # then radius is difference in x,y and x,F(x) 365 return cost(x) 366 # if xtol=0, radius is difference in x,y and x,F(x); skip the optimization 367 try: 368 if not maxiter or not max(xtol): #iterables 369 return cost(x) 370 except TypeError: 371 if not xtol: #non-iterables 372 return cost(x) 366 373 367 374 # set the range constraints … … 373 380 if debug: stepmon = VerboseMonitor(1) 374 381 #XXX: edit settings? 375 imax=3000;MINMAX = 1 #XXX: confirm MINMAX=1 is minimization382 MINMAX = 1 #XXX: confirm MINMAX=1 is minimization 376 383 if npop: # use VTR 377 384 results = diffev2(cost, x, npop, ftol=tol, gtol=None, \ 378 itermon = stepmon, maxiter= imax, bounds=bounds, \385 itermon = stepmon, maxiter=maxiter, bounds=bounds, \ 379 386 full_output=1, disp=0, handler=False) 380 387 else: # use VTR 381 388 results = fmin_powell(cost, x, ftol=tol, gtol=None, \ 382 itermon = stepmon, bounds=bounds, \389 itermon = stepmon, maxiter=maxiter, bounds=bounds, \ 383 390 full_output=1, disp=0, handler=False) 384 391 #solved = results[0] # x' … … 393 400 394 401 #XXX: better to do a single optimization rather than for each point ??? 395 d = [radius(model, point, tol, xtol, npop ) for point in target]402 d = [radius(model, point, tol, xtol, npop, imax) for point in target] 396 403 return infeasibility(d, cutoff) 397 404 -
branches/UQ/math/legacy/test_ExampleDataset.py
r546 r556 55 55 print("testing with some 'wiggle-room'...") 56 56 Cs = 0.25 57 Cx = 1.0; Cy = 2.0 58 npop = None # optimizer population per generation 57 Cx = 0.5; Cy = 0.25 59 58 60 59 # NOTES: for no 'cutoff', use cutoff=None; for is_feasible, use raw=False … … 64 63 65 64 # Check model validity 66 Rv = ex1d_data.valid(F, xtol=Cx, tol=Cy, npop=npop,\65 Rv = ex1d_data.valid(F, xtol=Cx, tol=Cy, \ 67 66 raw=True, blamelist=False, pairs=False, all=False) 68 67 print("valid(ytol=%s,xtol=%s):\n%s" % (Cy, Cx, Rv)) -
branches/UQ/math/legacy/test_ModeledDataset.py
r546 r556 27 27 def added(x): 28 28 return sum(x) 29 def first_mass(x): 30 return x[0] 31 #F = first_mass 29 32 F = sum_squared 30 33 #F = added … … 37 40 # settings 38 41 print("testing with some 'wiggle-room'...") 39 npop = None # optimizer population per generation40 42 41 43 # Check model validity 42 44 Cx = 0.0; Cy = 1.0 43 Rv = data.valid(F, xtol=Cx, tol=Cy, npop=npop,\45 Rv = data.valid(F, xtol=Cx, tol=Cy, \ 44 46 raw=False, blamelist=False, pairs=False, all=True) 45 47 print("valid(ytol=%s,xtol=%s):\n%s" % (Cy, Cx, Rv)) 46 48 47 49 Cx = 0.0; Cy = 2.0 48 Rv = data.valid(F, xtol=Cx, tol=Cy, npop=npop,\50 Rv = data.valid(F, xtol=Cx, tol=Cy, \ 49 51 raw=False, blamelist=False, pairs=False, all=True) 50 52 print("valid(ytol=%s,xtol=%s):\n%s" % (Cy, Cx, Rv)) 51 53 52 54 Cx = 1.0; Cy = 2.0 53 Rv = data.valid(F, xtol=Cx, tol=Cy, npop=npop,\55 Rv = data.valid(F, xtol=Cx, tol=Cy, \ 54 56 raw=False, blamelist=False, pairs=False, all=True) 55 57 print("valid(ytol=%s,xtol=%s):\n%s" % (Cy, Cx, Rv)) 56 58 57 59 Cx = 2.0; Cy = 2.0 58 Rv = data.valid(F, xtol=Cx, tol=Cy, npop=npop,\60 Rv = data.valid(F, xtol=Cx, tol=Cy, \ 59 61 raw=False, blamelist=False, pairs=False, all=True) 60 62 print("valid(ytol=%s,xtol=%s):\n%s" % (Cy, Cx, Rv)) -
branches/UQ/math/legacy/test_StAlDataset.py
r546 r556 45 45 print("testing with some 'wiggle-room'...") 46 46 Cs = 0.25 47 Cx = 50.0; Cy = 50.0 48 npop = None # optimizer population per generation 47 Cx = 0.0; Cy = 1.75 49 48 50 49 # NOTES: for no 'cutoff', use cutoff=None; for is_feasible, use raw=False … … 54 53 55 54 # Check model validity 56 Rv = st_al_data.valid(F, xtol=Cx, tol=Cy, npop=npop,\55 Rv = st_al_data.valid(F, xtol=Cx, tol=Cy, \ 57 56 raw=True, blamelist=False, pairs=False, all=False) 58 57 print("valid(ytol=%s,xtol=%s):\n%s" % (Cy, Cx, Rv))
Note: See TracChangeset
for help on using the changeset viewer.