You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
I've noticed that the order in which I add stressmodels to the model have an effect on the result. I've produced an example below which shows this using three stressmodels and 6 different add-orders.
The difference isn't very large using this example, but I run more complicated models and there can be a very large difference between the best and worst order with respect to NSE-measure. I've had best NSE at around 0.9 while at the same time worst around NSE 0.1, and many values in between those extremes.
What could be the reason for this behaviour?
Is there a logical best order in which the stressmodels should be added?
import pastas as ps
import pandas as pd
import itertools
def test_sm_add_order():
dates = pd.date_range('2022-01-01', '2022-06-30')
well = [0 for _ in range(30)]
well.extend([50 for _ in range(40)])
well.extend([100 for _ in range(60)])
well.extend([0 for _ in range(len(dates) - len(well))])
well = pd.Series(well, index=dates.copy(), name='well')
well2 = [86 for _ in range(30)]
well2.extend([2 for _ in range(40)])
well2.extend([57 for _ in range(60)])
well2.extend([299 for _ in range(len(dates) - len(well2))])
well2 = pd.Series(well2, index=dates.copy(), name='well2')
well3 = [100 for _ in range(30)]
well3.extend([40 for _ in range(40)])
well3.extend([10 for _ in range(60)])
well3.extend([56 for _ in range(len(dates) - len(well3))])
well3 = pd.Series(well3, index=dates.copy(), name='well3')
# print(', '.join((np.random.randint(17, 22, len(dates)))))
vals = [18, 21, 19, 18, 17, 20, 21, 17, 17, 18, 19, 20, 19, 20, 18, 19, 21, 21, 17, 17, 19, 19, 21, 17
, 19, 19, 17, 17, 17, 21, 20, 17, 20, 18, 21, 19, 19, 20, 18, 19, 17, 18, 19, 19, 17, 20, 20, 21
, 19, 19, 17, 18, 21, 18, 18, 18, 20, 21, 18, 18, 20, 19, 18, 19, 19, 21, 17, 21, 21, 21, 18, 20
, 21, 19, 20, 21, 20, 18, 18, 20, 18, 18, 19, 20, 18, 21, 19, 21, 18, 21, 17, 20, 20, 18, 18, 19
, 17, 21, 17, 21, 21, 19, 17, 19, 18, 17, 19, 21, 17, 20, 19, 21, 17, 20, 20, 20, 20, 17, 17, 18
, 18, 21, 19, 17, 17, 21, 17, 18, 20, 18, 21, 18, 17, 18, 21, 19, 18, 21, 17, 18, 20, 19, 17, 20
, 21, 18, 20, 18, 20, 17, 21, 20, 20, 21, 20, 18, 19, 17, 21, 19, 20, 20, 18, 17, 21, 21, 19, 18
, 19, 21, 19, 20, 17, 17, 17, 20, 19, 20, 19, 18, 18]
dep = pd.Series(vals, dates, name='dep')
independents = [well, well2, well3]
calibration_combinations = list(itertools.permutations(independents, 3))
parameters = []
for idx, combo in enumerate(calibration_combinations):
ml = ps.Model(dep)
for s in combo:
sm = ps.StressModel(s, ps.rfunc.Hantush, s.name, up=False)
ml.add_stressmodel(sm)
ml.solve(solver=ps.solver.LmfitSolve, noise=False, report=False) #LeastSquares
p = ml.parameters.reset_index()
p['combo'] = '_'.join([s.name for s in combo])
parameters.append(p)
df = pd.concat(parameters)
for name, p in df.groupby('index'):
print(f"{name} mean: {round(p['optimal'].mean(), 8)}, "
f"std: {round(p['optimal'].std(), 8)}, "
f"min: {round(p['optimal'].min(), 8)}, "
f"max: {round(p['optimal'].max(), 8)}")
test_sm_add_order()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi.
I've noticed that the order in which I add stressmodels to the model have an effect on the result. I've produced an example below which shows this using three stressmodels and 6 different add-orders.
The difference isn't very large using this example, but I run more complicated models and there can be a very large difference between the best and worst order with respect to NSE-measure. I've had best NSE at around 0.9 while at the same time worst around NSE 0.1, and many values in between those extremes.
What could be the reason for this behaviour?
Is there a logical best order in which the stressmodels should be added?
This produces the result:
Beta Was this translation helpful? Give feedback.
All reactions