예제 #1
0
    def __init__(self, beta=0.95, c=0.6, F_a=1, F_b=1, G_a=3, G_b=1.2,
                 w_max=2, w_grid_size=40, pi_grid_size=40):

        self.beta, self.c, self.w_max = beta, c, w_max
        self.F = beta_distribution(F_a, F_b, scale=w_max)
        self.G = beta_distribution(G_a, G_b, scale=w_max)
        self.f, self.g = self.F.pdf, self.G.pdf    # Density functions
        self.pi_min, self.pi_max = 1e-3, 1 - 1e-3  # Avoids instability
        self.w_grid = np.linspace(0, w_max, w_grid_size)
        self.pi_grid = np.linspace(self.pi_min, self.pi_max, pi_grid_size)
        x, y = np.meshgrid(self.w_grid, self.pi_grid)
        self.grid_points = np.column_stack((x.ravel(1), y.ravel(1)))
예제 #2
0
 def __init__(self, beta=0.95, c=0.6, F_a=1, F_b=1, G_a=3, G_b=1.2, 
         w_max=2, w_grid_size=40, pi_grid_size=40):
     """
     Sets up parameters and grid.  The attribute "grid_points" defined
     below is a 2 column array that stores the 2D grid points for the DP
     problem. Each row represents a single (w, pi) pair.
     """
     self.beta, self.c, self.w_max = beta, c, w_max
     self.F = beta_distribution(F_a, F_b, scale=w_max)
     self.G = beta_distribution(G_a, G_b, scale=w_max)
     self.f, self.g = self.F.pdf, self.G.pdf    # Density functions
     self.pi_min, self.pi_max = 1e-3, 1 - 1e-3  # Avoids instability
     self.w_grid = np.linspace(0, w_max, w_grid_size)
     self.pi_grid = np.linspace(self.pi_min, self.pi_max, pi_grid_size)
     x, y = np.meshgrid(self.w_grid, self.pi_grid)
     self.grid_points = np.column_stack((x.ravel(1), y.ravel(1)))
예제 #3
0
 def __init__(self,
              beta=0.95,
              c=0.6,
              F_a=1,
              F_b=1,
              G_a=3,
              G_b=1.2,
              w_max=2,
              w_grid_size=40,
              pi_grid_size=40):
     """
     Sets up parameters and grid.  The attribute "grid_points" defined
     below is a 2 column array that stores the 2D grid points for the DP
     problem. Each row represents a single (w, pi) pair.
     """
     self.beta, self.c, self.w_max = beta, c, w_max
     self.F = beta_distribution(F_a, F_b, scale=w_max)
     self.G = beta_distribution(G_a, G_b, scale=w_max)
     self.f, self.g = self.F.pdf, self.G.pdf  # Density functions
     self.pi_min, self.pi_max = 1e-3, 1 - 1e-3  # Avoids instability
     self.w_grid = np.linspace(0, w_max, w_grid_size)
     self.pi_grid = np.linspace(self.pi_min, self.pi_max, pi_grid_size)
     x, y = np.meshgrid(self.w_grid, self.pi_grid)
     self.grid_points = np.column_stack((x.ravel(1), y.ravel(1)))
예제 #4
0
def compute_pdf_y_values(alpha, beta, x_values=X_VALUES):
    return beta_distribution(alpha, beta).pdf(x_values)