# shrinkage.ChainFusedLasso

Shrinkage for Python · 0.2.0

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/packages/python/src/shrinkage/penalty.py>)

<a id="constructor"></a>

```python
ChainFusedLasso(
    l1: float,
    fusion: float,
    *,
    weights: npt.ArrayLike | None = None
)
```

L1 plus weighted fusion of adjacent coefficients in feature order.

The penalty is \`\`l1 \* sum(abs(beta)) + fusion \* sum(weights \* abs(diff(beta)))\`\`. Strengths and weights must be finite and nonnegative. `weights=None` uses unit weights; explicit weights must have length `max(n_features - 1, 0)`. Zero weights cut the chain. Weight sequences are copied into an immutable tuple. The intercept is excluded.

<a id="l1"></a>

## `l1`

```python
l1: float
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/packages/python/src/shrinkage/penalty.py>)

<a id="fusion"></a>

## `fusion`

```python
fusion: float
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/packages/python/src/shrinkage/penalty.py>)

<a id="weights"></a>

## `weights`

```python
weights: tuple[float, ...] | None
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/packages/python/src/shrinkage/penalty.py>)

<a id="__init__"></a>

## `__init__`

```python
__init__(
    l1: float,
    fusion: float,
    *,
    weights: npt.ArrayLike | None = None
) -> None
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/packages/python/src/shrinkage/penalty.py>)
