Started with PreferenceExpectedImprovement.py
This commit is contained in:
parent
2ffaa3aead
commit
c8d4022cd4
19
AcquistionFunctions/PreferenceExpectedImprovement.py
Normal file
19
AcquistionFunctions/PreferenceExpectedImprovement.py
Normal file
@ -0,0 +1,19 @@
|
||||
import numpy as np
|
||||
from scipy.stats import norm
|
||||
|
||||
|
||||
class PreferenceExpectedImprovement:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def rejection_sampling(self):
|
||||
pass
|
||||
|
||||
def expected_improvement(self):
|
||||
pass
|
||||
|
||||
def update_user_preference_model(self):
|
||||
pass
|
||||
|
||||
def update_proposal_model(self):
|
||||
pass
|
25
DistTesting/Testing.py
Normal file
25
DistTesting/Testing.py
Normal file
@ -0,0 +1,25 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# Define the Gaussian distribution
|
||||
mu, sigma = 0, 5 # High variance
|
||||
gaussian = np.random.normal(mu, sigma, 1000000) # Generate a lot of samples
|
||||
|
||||
# Rejection sampling
|
||||
gaussian = gaussian[(gaussian > -1) & (gaussian < 1)]
|
||||
|
||||
# Generate uniform distribution
|
||||
uniform = np.random.uniform(-1, 1, len(gaussian)) # Same number of samples as the Gaussian
|
||||
|
||||
# Plot the distributions
|
||||
plt.figure(figsize=(12,6))
|
||||
|
||||
plt.subplot(1, 2, 1)
|
||||
plt.hist(gaussian, bins=30, density=True, alpha=0.6, color='g')
|
||||
plt.title('Gaussian Rejection Sampling')
|
||||
|
||||
plt.subplot(1, 2, 2)
|
||||
plt.hist(uniform, bins=30, density=True, alpha=0.6, color='b')
|
||||
plt.title('Uniform Distribution')
|
||||
|
||||
plt.show()
|
Loading…
Reference in New Issue
Block a user