Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes some prints #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
__pycache__
*.egg-info
10 changes: 5 additions & 5 deletions holo/test_functions/closed_form/_ehrlich.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def __init__(
self.initial_dist = torch.ones(num_states) / num_states
bandwidth = int(num_states * 0.4)
self.transition_matrix = sample_sparse_ergodic_transition_matrix(
num_states, bandwidth, softmax_temp=0.5, generator=self._generator, repeats_always_possible=True
num_states,
bandwidth,
softmax_temp=0.5,
generator=self._generator,
repeats_always_possible=True,
)
self.stationary_dist = dmp_stationary_dist(self.transition_matrix)

Expand Down Expand Up @@ -129,22 +133,18 @@ def optimal_solution(self):
]
)
index = spacing.cumsum(0).tolist()
print(index)
motif = motif.tolist()
for idx in range(index[-1] + 1):
if idx in index:
next_state = motif.pop(0)
soln[position] = next_state
# print(position)
position += 1
# fill in remaining states with last state of last motif
soln[position:] = soln[position - 1]

# check optimal value
optimal_value = self.evaluate_true(soln.unsqueeze(0))
if not optimal_value == self._optimal_value:
print(soln)
print(optimal_value)
raise RuntimeError("optimal value not achieved by optimal solution.")
return soln

Expand Down
4 changes: 0 additions & 4 deletions holo/test_functions/elemental/_discrete_markov_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ def sample_sparse_ergodic_transition_matrix(
generator = torch.Generator()

randn_matrix = torch.randn(num_states, num_states, generator=generator)
print(randn_matrix)
dense_transition_matrix = (randn_matrix / softmax_temp).softmax(dim=-1)
print(dense_transition_matrix)

# construct mask as banded matrix
mask = banded_square_matrix(num_states, bandwidth).bool()
Expand All @@ -116,8 +114,6 @@ def sample_sparse_ergodic_transition_matrix(
# set diagonal entries of mask to True
mask = mask | torch.eye(num_states, dtype=torch.bool)

print(mask)

transition_matrix = torch.where(mask, dense_transition_matrix, torch.zeros_like(dense_transition_matrix))
transition_matrix = transition_matrix / transition_matrix.sum(dim=-1, keepdim=True)

Expand Down