Skip to content

Commit

Permalink
initial update for uncertainty perturbation workflow notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
deronsmith committed Nov 4, 2024
1 parent f8c8dcf commit 7dfd6bb
Show file tree
Hide file tree
Showing 11 changed files with 62,794 additions and 107,164 deletions.
11 changes: 6 additions & 5 deletions esat/data/datahandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,12 @@ def _determine_optimal_block(self, input_data=None):
if input_data is None:
input_data = self.input_data.to_numpy()
try:
optimal_blocks = optimal_block_length(input_data)
optimal_block = []
for opt in optimal_blocks:
optimal_block.append(opt.b_star_cb)
self.optimal_block = math.floor(np.mean(optimal_block))
with np.errstate(divide='ignore', invalid='ignore'):
optimal_blocks = optimal_block_length(input_data)
optimal_block = []
for opt in optimal_blocks:
optimal_block.append(opt.b_star_cb)
self.optimal_block = math.floor(np.mean(optimal_block))
except ValueError as e:
self.optimal_block = int(input_data.shape[1]/5)
logger.error(f"Unable to determine optimal block size. Setting default to {self.optimal_block}")
Expand Down
13 changes: 8 additions & 5 deletions esat/model/sa.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,14 @@ def initialize(self,
f"of factors.")

if prior_H is not None:
_p_i = prior_H.shape[0]
_H = H[_p_i:]
_H = (_H / _H.sum(axis=0)) * (1.0 - H_ratio)
_prior_H = (prior_H / prior_H.sum(axis=0)) * H_ratio
H = np.vstack((_prior_H, _H))
for i in range(prior_H.shape[0]):
H[i] = prior_H[i]
H = H / H.sum(axis=0)
# _p_i = prior_H.shape[0]
# _H = H[_p_i:]
# _H = (_H / _H.sum(axis=0)) * (1.0 - H_ratio)
# _prior_H = (prior_H / prior_H.sum(axis=0)) * H_ratio
# H = np.vstack((_prior_H, _H))
H[H <= 0.0] = 1e-12
self.H = H
self.W = W
Expand Down
58,808 changes: 5,267 additions & 53,541 deletions notebooks/.ipynb_checkpoints/epa_esat_input-perturbation-workflow-checkpoint.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 7dfd6bb

Please sign in to comment.