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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#! /usr/bin/env python
import openturns as ot
ot.TESTPREAMBLE()
# Realization issued from a SpectralProcess
dimension = 1
# Parameters of the distribution
N = 101
t0 = 0.0
dt = 0.1
myTimeGrid = ot.RegularGrid(t0, dt, N)
# Create a Sample
# parameters of gaussien impose a few risk to get negative values
mySample = ot.Normal(10, 3).getSample(N)
# get a realization from distribution
myRealization = ot.TimeSeries(myTimeGrid, mySample)
# Create the lambda parameter
lambdaVector = ot.Point(dimension)
for index in range(dimension):
lambdaVector[index] = (index + 2.0) * 0.1
myBoxCox = ot.BoxCoxTransform(lambdaVector)
print("myBoxCox=", myBoxCox)
# Get the input and output dimension
print("myBoxCox input dimension = ", myBoxCox.getInputDimension())
print("myBoxCox output dimension = ", myBoxCox.getOutputDimension())
# Evaluation of the BoxCoxTransform on the realization
print("input time series =")
print(myRealization)
print("output time series = ")
print(myBoxCox(myRealization))
print("gradient=", myBoxCox.gradient([0.5]))
print("hessian=", myBoxCox.hessian([0.5]))
# Call the getInverse method
myInverseBoxCox = myBoxCox.getInverse()
print("myInverseBoxCox = ", myInverseBoxCox)
# Get the number of calls
print("number of call(s) : ", myBoxCox.getCallsNumber())
|