Skip to content
Snippets Groups Projects
Commit f18ea5aa authored by kohlhaasrebecca's avatar kohlhaasrebecca
Browse files

Add _y_hat_prev for adaptive tradeoff scheme

parent 0c7460ab
No related branches found
No related tags found
2 merge requests!32Merge last changes for new release,!30Moved AL into SeqDesign and restructured score combination
...@@ -238,6 +238,7 @@ if __name__ == "__main__": ...@@ -238,6 +238,7 @@ if __name__ == "__main__":
- exploration = 'Voronoi' creates mismatching numbers of candidates and weights - exploration = 'Voronoi' creates mismatching numbers of candidates and weights
- exploration = 'loocv' needs MetaModel.create_ModelError, which does not exist - exploration = 'loocv' needs MetaModel.create_ModelError, which does not exist
- exploration = 'dual annealing' restricted in what it allows as exploitation methods - exploration = 'dual annealing' restricted in what it allows as exploitation methods
- tradeoff = 'adaptive' perhaps not possible in the first AL iteration?
The following combinations are running through: The following combinations are running through:
- BayesActDesign quite fast - BayesActDesign quite fast
...@@ -253,7 +254,7 @@ if __name__ == "__main__": ...@@ -253,7 +254,7 @@ if __name__ == "__main__":
tradeoff_schemes = [None, 'equal', 'epsilon-decreasing', 'adaptive'] tradeoff_schemes = [None, 'equal', 'epsilon-decreasing', 'adaptive']
#sampling_method = ['random', 'latin-hypercube', 'sobol', 'halton', #sampling_method = ['random', 'latin-hypercube', 'sobol', 'halton',
# 'hammersley', 'chebyshev', 'grid'] # 'hammersley', 'chebyshev', 'grid']
exploration_schemes = ['Voronoi', 'random', 'latin-hypercube', 'LOOCV', exploration_schemes = ['Voronoi', 'global_mc', 'random', 'latin-hypercube', 'LOOCV',
'dual annealing'] 'dual annealing']
exploration_schemes = ['random', 'dual annealing'] exploration_schemes = ['random', 'dual annealing']
exploitation_schemes = ['BayesOptDesign', 'BayesActDesign', 'VarOptDesign', exploitation_schemes = ['BayesOptDesign', 'BayesActDesign', 'VarOptDesign',
......
...@@ -488,6 +488,7 @@ class Engine: ...@@ -488,6 +488,7 @@ class Engine:
# self.MetaModel.ExpDesignFlag = 'sequential' # self.MetaModel.ExpDesignFlag = 'sequential'
# TODO: this is only a fix, remove as soon as possible to # TODO: this is only a fix, remove as soon as possible to
# avoid circular dependencies! # avoid circular dependencies!
self.SeqDesign._y_hat_prev = self._y_hat_prev
if self.ExpDesign.exploit_method.lower() == 'bayesoptdesign': if self.ExpDesign.exploit_method.lower() == 'bayesoptdesign':
self.SeqDesign.engine = self self.SeqDesign.engine = self
Xnew, updatedPrior = self.SeqDesign.choose_next_sample(TotalSigma2, Xnew, updatedPrior = self.SeqDesign.choose_next_sample(TotalSigma2,
......
...@@ -597,6 +597,11 @@ class SequentialDesign: ...@@ -597,6 +597,11 @@ class SequentialDesign:
mseError = mean_squared_error(pce_y, y) mseError = mean_squared_error(pce_y, y)
# Mean squared CV - error for last design point # Mean squared CV - error for last design point
# TODO: _y_hat_prev is only calculated after the first sequential
# iteration scheme! Either work around this, or calculate
# anyway.
if self._y_hat_prev is None:
raise AttributeError('Adaptive tradeoff scheme cannot be used in the first sequential iteration!')
pce_y_prev = np.array(list(self._y_hat_prev.values()))[:, 0] pce_y_prev = np.array(list(self._y_hat_prev.values()))[:, 0]
mseCVError = mean_squared_error(pce_y_prev, y) mseCVError = mean_squared_error(pce_y_prev, y)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment