<a id="mu-estimator"></a>

<a id="expected-return-estimator"></a>

# Expected Return Estimator

An [expected return estimator](https://skfolio.org/api.html.md#mu-ref) estimates the expected returns (`mu`) of
the assets.

It follows the same API as scikit-learn’s `estimator`: the `fit` method takes `X` as
the assets returns and stores the expected returns in its  `mu_` attribute.
`X` can be any array-like structure (numpy array, pandas DataFrame, etc.)

`mu_` is expressed in the periodicity of `X` (daily returns give daily expected
returns) and is consumed as is by the optimizers, without annualization (see
[Periodicity Convention](https://skfolio.org/user_guide/data_preparation.html.md#periodicity-convention)).

Available estimators are:
: * [`EmpiricalMu`](https://skfolio.org/generated/skfolio.moments.EmpiricalMu.html.md#skfolio.moments.EmpiricalMu)
  * [`EWMu`](https://skfolio.org/generated/skfolio.moments.EWMu.html.md#skfolio.moments.EWMu)
  * [`EquilibriumMu`](https://skfolio.org/generated/skfolio.moments.EquilibriumMu.html.md#skfolio.moments.EquilibriumMu)
  * [`ShrunkMu`](https://skfolio.org/generated/skfolio.moments.ShrunkMu.html.md#skfolio.moments.ShrunkMu)

For online learning and streaming workflows, [`EWMu`](https://skfolio.org/generated/skfolio.moments.EWMu.html.md#skfolio.moments.EWMu) supports
incremental updates with `partial_fit`. It also supports NaN-aware updates with
`active_mask`, which helps distinguish assets that belong to the universe but have
missing returns (e.g. holidays), from assets outside the universe (e.g. pre-listing
or post-delisting periods).
See [Online Learning](https://skfolio.org/user_guide/online_learning.html.md#online-learning) for the full online workflow, including online
portfolio optimization evaluation with incremental moments.
See [Missing Data and Changing Universes](https://skfolio.org/user_guide/data_representation.html.md#missing-data) for the full convention
on NaNs, universe membership, estimator warmup and investability.

**Example:**

```python
from skfolio.datasets import load_sp500_dataset
from skfolio.moments import EmpiricalMu
from skfolio.preprocessing import prices_to_returns

prices = load_sp500_dataset()
X = prices_to_returns(prices)

model = EmpiricalMu()
model.fit(X)
print(model.mu_)
```
