Exemplo n.º 1
0
    def setUp(self):
        SP.random.seed(1)
        self.n_dimensions = 2
        self.n_samples = 100
        self.setXy()
        #self.X = SP.rand(self.n_samples,self.n_dimensions)
        covar = dlimix.CCovSqexpARD(self.n_dimensions)
        ll = dlimix.CLikNormalIso()
        covar_params = SP.array([1, 1, 1])
        lik_params = SP.array([0.5])
        hyperparams0 = dlimix.CGPHyperParams()
        hyperparams0['covar'] = covar_params
        hyperparams0['lik'] = lik_params
        self.constrainU = dlimix.CGPHyperParams()
        self.constrainL = dlimix.CGPHyperParams()
        self.constrainU['covar'] = +10 * SP.ones_like(covar_params)
        self.constrainL['covar'] = 0 * SP.ones_like(covar_params)
        self.constrainU['lik'] = +5 * SP.ones_like(lik_params)
        self.constrainL['lik'] = 0 * SP.ones_like(lik_params)

        self.gp = dlimix.CGPbase(covar, ll)
        self.gp.setX(self.X)
        self.gp.setParams(hyperparams0)
        #self.genY()
        self.gp.setY(self.y)
Exemplo n.º 2
0
    def setUp(self):
        SP.random.seed(1)

        #1. simulate
        self.settings = {'K': 5, 'N': 100, 'D': 80}
        self.simulation = self.simulate()

        N = self.settings['N']
        K = self.settings['K']
        D = self.settings['D']

        #2. setup GP
        covar = dlimix.CCovLinearISO(K)
        ll = dlimix.CLikNormalIso()
        #create hyperparm
        covar_params = SP.array([1.0])
        lik_params = SP.array([1.0])
        hyperparams = dlimix.CGPHyperParams()
        hyperparams['covar'] = covar_params
        hyperparams['lik'] = lik_params
        hyperparams['X'] = self.simulation['X0']
        #cretae GP
        self.gp = dlimix.CGPbase(covar, ll)
        #set data
        self.gp.setY(self.simulation['Y'])
        self.gp.setX(self.simulation['X0'])
        self.gp.setParams(hyperparams)
        pass
Exemplo n.º 3
0
 def setUp(self):
     SP.random.seed(1)
     self.n=10
     self.n_dim=10
     X=SP.rand(self.n,self.n_dim)
     self.C = dlimix.CLikNormalIso()
     self.name = 'CLikNormalIso'
     self.C.setX(X)
     self.n_params=self.C.getNumberParams()
     params=SP.exp(SP.randn(self.n_params))
     self.C.setParams(params)
Exemplo n.º 4
0
    def setUp(self):
        SP.random.seed(1)

        #1. simulate
        self.settings = {'K': 5, 'N': 100, 'D': 80}
        self.simulation = self.simulate()

        N = self.settings['N']
        K = self.settings['K']
        D = self.settings['D']

        #2. setup GP
        K0 = SP.dot(self.simulation['S'], self.simulation['S'].T)
        K0[:] = 0

        covar1 = dlimix.CFixedCF(K0)
        covar2 = dlimix.CCovLinearISO(K)
        covar = dlimix.CSumCF()
        covar.addCovariance(covar1)
        covar.addCovariance(covar2)

        ll = dlimix.CLikNormalIso()
        #create hyperparm
        covar_params = SP.array([0.0, 1.0])
        lik_params = SP.array([0.1])
        hyperparams = dlimix.CGPHyperParams()
        hyperparams['covar'] = covar_params
        hyperparams['lik'] = lik_params
        hyperparams['X'] = self.simulation['X0']
        #cretae GP
        self.gp = dlimix.CGPbase(covar, ll)
        #set data
        self.gp.setY(self.simulation['Y'])
        self.gp.setX(self.simulation['X0'])
        self.gp.setParams(hyperparams)
        pass