<a id="skfolio-measures-semi-variance"></a>

# skfolio.measures.semi_variance

<a id="skfolio.measures.semi_variance"></a>

### skfolio.measures.semi_variance(returns, min_acceptable_return=None, sample_weight=None, biased=False)

Compute the semi-variance (second lower partial moment).

The semi-variance is the variance of the returns below a minimum acceptable return.

* **Parameters:**
  **returns** *ndarray of shape (n_observations,) or (n_observations, n_assets)*
  : Array of return values.

  **min_acceptable_return** *float or ndarray of shape (n_assets,) optional*
  : Minimum acceptable return. It is the return target to distinguish “downside” and
    “upside” returns. The default (`None`) is to use the returns’ mean.

  **biased** *bool, default=False*
  : If False (default), computes the sample semi-variance (unbiased); otherwise,
    computes the population semi-variance (biased).

  **sample_weight** *ndarray of shape (n_observations,), optional*
  : Sample weights for each observation. If None, equal weights are assumed.
* **Returns:**
  **value** *float or ndarray of shape (n_assets,)*
  : Semi-variance.
    If `returns` is a 1D-array, the result is a float.
    If `returns` is a 2D-array, the result is a ndarray of shape (n_assets,).

### Notes

NaN handling:
- Unweighted: NaNs are ignored; all-NaN inputs yield NaN.
- Weighted: NaNs propagate.

