Note

Click here to download the full example code

# Cost Segment Structure [ex103.0]¶

Defines a cost segment which consists of an ALSSM and a left-sided, exponentially decaying window.

See also:
Cost Function Classes,
`CostSegment`

,
`Segment`

Out:

```
CostSegment : label: costs segment for polynomial model
└- Alssm : polynomial, A: (3, 3), C: (1, 3), label: alssm-polynomial,
└- Segment : a:-inf, b:-1, fw, g:50, delta:0, label: left-decaying
```

```
import numpy as np
import lmlib as lm
# Defining an second order polynomial ALSSM
alssm_poly = lm.AlssmPoly(poly_degree=2, label="alssm-polynomial")
# Defining a segment with a left-sided, exponentially decaying window
a = -np.inf # left boundary
b = -1 # right boundary
g = 50 # effective weighted number of sample under the window (controlling the window size)
left_seg = lm.Segment(a, b, lm.FORWARD, g, label="left-decaying")
# creating the cost segment, combining window (segment) and model (ALSSM).
costs = lm.CostSegment(alssm_poly, left_seg, label="costs segment for polynomial model")
# print internal structure
print(costs)
```

**Total running time of the script:** ( 0 minutes 0.036 seconds)