Esempio n. 1
0
from helper.state import saver, loader

p = 10
n_true = 50000


def make_X():
    '''Returns list of bounded features with EXᵢ = 0 and Var[Xᵢ] = 1'''
    α = lambda: rn.uniform(0.1, 10)
    β = lambda: rn.uniform(0.1, 10)
    Xs = [KumaraswamyDistribution(α(), β()) for _ in range(p)]
    Xs = [(X - E(X)) / Std(X) for X in Xs]
    return Xs


R = NormalDistribution(8, 10)
X = make_X()
M = synth.GaussianMarket(X, R)

X, R = M.sample(n_true)
M = synth.MarketDiscreteDistribution(X, R)

X = DiscreteDistribution(X)
R = DiscreteDistribution(R)

n_experiments = 800
λs = np.arange(0, 13.2, 0.2)
n = 200
δ = 0.2
βs = [1, 0.99, 0.5, 0.1, 0.01]
Esempio n. 2
0
from model.distrs import StudentTDistribution, DiscreteDistribution, NormalDistribution
from model.distrs import E, Var, Std
import model.synth_data as synth
import model.utility as ut
import model.problem as pr

from helper.state import saver, loader
from helper.plotting import plt

l = AttrDict()

l.p = 25
l.n_true = 50000

# Continuous market distribution
R_true = NormalDistribution(8, 10)
X_true = [StudentTDistribution(ν=4)
          for _ in range(l.p)]  # EXᵢ = 0, Var(Xᵢ) = 1
l.M_true = synth.GaussianMarket(X_true,
                                R_true)  # constant corr(Xᵢ,R) = 1/p - ε

# Discretized sampled distribution in order to have real q⋆
X, R = l.M_true.sample(l.n_true)
l.M = synth.MarketDiscreteDistribution(X, R)

l.n_experiments = 100
l.λ = 3
l.δ = 0.2
l.ns = np.arange(25, 2025, 25)
l.Rf = 0
Esempio n. 3
0
#Utility
β = 1
r_threshold = 60
u = ut.LinearPlateauUtility(β, r_threshold)

Rf = 0

# In[25]:

print(ns)

# In[26]:

# True market
R_true = NormalDistribution(8, 10)
X_true = [1 / np.sqrt(2) * StudentTDistribution(ν=4) for _ in range(p)]
M_true = synth.GaussianMarket(X_true, R_true)

# Discretized market
X, R = M_true.sample(n_true)
M = synth.MarketDiscreteDistribution(X, R)

# In[27]:

# Real q∗ value computation
p_star = pr.Problem(X, R, λ=0, u=u)
p_star.solve()
q_star = p_star.q

# In[28]: