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
Describe the bug
Given two events E1 and E2 with a certain probability of occurrence. Each event leads to certain values according to a normal distribution. To calculate the overall probability for the values, also considering the probability of occurrence of the events, I want to use the GeneralMixtureModel.
The normal distributions are the input values for the GeneralMixtureModel(), which leads to a mixed probability distribution. But as the probability of occurrence varies, they are used as weights. The problem is that the weights seem to have no influence on the result at all. Varying E1_prob and/or E2_prob does not change the result.
To Reproduce
from pomegranate.distributions import *
from pomegranate.gmm import GeneralMixtureModel
import numpy as np
import matplotlib.pyplot as plt
# Probability of occurrence of events
E1_prob = 9.79E-1
E2_prob = 1-9.79E-1
# Values in case the event occurs
E1_values = Normal([1000.0], [[200.0**2]])
E2_values = Normal([2000.0], [[400.0**2]])
# Overall probability for values
Values_overall = GeneralMixtureModel([E1_values,E2_values])
Values_overall.weights = [E1_prob,E2_prob]
x = np.linspace(-200, 4000, 1000).reshape(-1, 1) # Reshape x to be a 2D array
pdf = Values_overall.probability(x)
# Plot the PDF
plt.figure(figsize=(10, 6))
plt.plot(x, pdf, label='Normal Distribution')
plt.xlabel('x')
plt.ylabel('Probability Density')
plt.legend()
plt.grid(True)
plt.show()
The text was updated successfully, but these errors were encountered:
Describe the bug
Given two events E1 and E2 with a certain probability of occurrence. Each event leads to certain values according to a normal distribution. To calculate the overall probability for the values, also considering the probability of occurrence of the events, I want to use the GeneralMixtureModel.
The normal distributions are the input values for the GeneralMixtureModel(), which leads to a mixed probability distribution. But as the probability of occurrence varies, they are used as weights. The problem is that the weights seem to have no influence on the result at all. Varying E1_prob and/or E2_prob does not change the result.
To Reproduce
The text was updated successfully, but these errors were encountered: