Skip to content

Commit

Permalink
missed one fiel
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdebus committed Jun 4, 2023
1 parent f7adea3 commit 8800629
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/tmcmc_umbridge/minimal-umbridge-model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import umbridge
import math

class TestModel(umbridge.Model):

def __init__(self):
super().__init__("forward")

def get_input_sizes(self, config):
return [3]

def get_output_sizes(self, config):
return [1]

def __call__(self, parameters, config):
x = parameters[0]

lik = math.exp(-.5*((x[0]-0.5)*(x[0]-0.5)/.01 + (x[1]-0.5)*(x[1]-0.5)/.01 + (x[2]-0.5)*(x[2]-0.5)/.01)) \
+ math.exp(-.5*((x[0]+0.5)*(x[0]+0.5)/.01 + (x[1]+0.5)*(x[1]+0.5)/.01 + (x[2]+0.5)*(x[2]+0.5)/.01)) \
+ math.exp(-.5*((x[0]-0.2)*(x[0]-0.2)/.01 + (x[1]+0.2)*(x[1]+0.2)/.01 + (x[2]+0.2)*(x[2]+0.2)/.01))

if (lik == 0):
return [[-1e100]]
return [[math.log(lik)]]

def supports_evaluate(self):
return True

testmodel = TestModel()

umbridge.serve_models([testmodel], 4242)

0 comments on commit 8800629

Please sign in to comment.