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

gaussian_mixture_conditional.py #211

Merged
merged 1 commit into from
Aug 16, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def __init__(self, conditional_name: str, metric_name: str, num_mixture_componen
self.mixture_weights = mixture_weights
self.metric_name = metric_name
self.sample_space = sample_space
self.weighted_mixture_distributions = []
self.weighted_mixture_distributions: List[List[float]] = []
self.generate_distributions()
self.combined_distribution = []
self.combined_distribution: List[float] = []

def generate_distributions(self) -> None:
"""
Expand Down Expand Up @@ -71,11 +71,11 @@ def generate_distributions_for_samples(self, samples: List[float], normalize: bo
for density_dist in dists:
d_arr = np.array(density_dist)
combined_density_dist = combined_density_dist + d_arr
combined_density_dist = list(combined_density_dist)
combined_density_dist_1 = list(combined_density_dist)
if normalize:
combined_prob_dist = list(np.array(combined_density_dist) * (1 / sum(combined_density_dist)))
combined_prob_dist = list(np.array(combined_density_dist_1) * (1 / sum(combined_density_dist_1)))
else:
combined_prob_dist = combined_density_dist
combined_prob_dist = combined_density_dist_1
return combined_prob_dist

@staticmethod
Expand All @@ -99,7 +99,7 @@ def to_dict(self) -> Dict[str, Any]:
"""
:return: a dict representation of the DTO
"""
d = {}
d: Dict[str, Any] = {}
d["conditional_name"] = self.conditional_name
d["dim"] = self.dim
d["num_mixture_components"] = self.num_mixture_components
Expand Down
Loading