-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptimalBatch5.py
More file actions
33 lines (24 loc) · 870 Bytes
/
optimalBatch5.py
File metadata and controls
33 lines (24 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import numpy as np
import optimalSampling
class LinearFunction2(optimalSampling.FittingFunctionLS):
def getFunction(self, xn, beta):
return beta[0]+beta[1]*xn+beta[2]*xn*xn
def getPartialDerivative1(self, xn, yn, beta, i):
if i==0:
return 1
elif i==1:
return xn
elif i==2:
return xn*xn
h=LinearFunction2()
h.sigma2=0.1
trueBeta=np.asarray([-0*0,-2*0,1])
X=np.asarray([[0],[0.5],[1]])
y=h.simulateFunctionAtMultiplePoints(X, trueBeta, True)
stepx=0.01
def CramerRaoBound2(I):
return optimalSampling.CramerRaoBound(I,2)
evaluator0=optimalSampling.FIMEvaluator()
evaluator1=optimalSampling.FIMEvaluator(CramerRaoBound2)
evaluator2=optimalSampling.VarEvaluator()
optimalSampling.simulateProcess(h,trueBeta,X,y,np.asarray([0,0,0]),100,np.mgrid[0:1+stepx:stepx],evaluator0, verbose=True)