File: t_BoxCoxTransform_std.py

package info (click to toggle)
openturns 1.24-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,204 kB
  • sloc: cpp: 256,662; python: 63,381; ansic: 4,414; javascript: 406; sh: 180; xml: 164; yacc: 123; makefile: 98; lex: 55
file content (51 lines) | stat: -rwxr-xr-x 1,290 bytes parent folder | download | duplicates (2)
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())