<a id="skfolio-factor-exposure-globalfactor"></a>

# skfolio.factor_exposure.GlobalFactor

<a id="skfolio.factor_exposure.GlobalFactor"></a>

### *class* skfolio.factor_exposure.GlobalFactor(\*, family='market')

Constant factor exposure equal to one for every asset.

`GlobalFactor` represents a cross-sectional regression intercept or broad market
factor in a characteristics factor model. It does not depend on any characteristic
field. It uses the panel dimensions to return an exposure matrix of ones with shape
`(n_observations, n_assets)`.

For each observation $t$ and asset $i$, the exposure is:

$$
x_{t,i} = 1
$$

This factor is typically used when the cross-sectional regression should estimate
a common return component in addition to characteristic-based style industry or
country factors.

* **Parameters:**
  **family** *str, default=”market”*
  : The factor family this exposure belongs to. Factor families group related
    factors for basket-neutral constraints, neutralization, attribution and
    reporting. The default is `"market"`.
* **Attributes:**
  **n_assets_** *int*
  : Number of assets seen during fitting.

  **asset_names_** *ndarray of shape (n_assets,)*
  : Asset names seen during fitting.

### Methods

| [`fit_transform`](#skfolio.factor_exposure.GlobalFactor.fit_transform)(X[, y])         | Return a constant exposure matrix.             |
|--------------------------------------------------------------------------------|------------------------------------------------|
| [`get_metadata_routing`](#skfolio.factor_exposure.GlobalFactor.get_metadata_routing)()        | Get metadata routing of this object.           |
| [`get_params`](#skfolio.factor_exposure.GlobalFactor.get_params)([deep])            | Get parameters for this estimator.             |
| [`partial_fit_transform`](#skfolio.factor_exposure.GlobalFactor.partial_fit_transform)(X[, y]) | Stateless class delegation to `fit_transform`. |
| [`set_params`](#skfolio.factor_exposure.GlobalFactor.set_params)(\*\*params)        | Set the parameters of this estimator.          |

### Examples

```pycon
>>> from skfolio.factor_exposure import GlobalFactor
>>> from skfolio.prior import CharacteristicsFactorModel
>>>
>>> model = CharacteristicsFactorModel(
...     factors=[("market", GlobalFactor())]
... )
```

<a id="skfolio.factor_exposure.GlobalFactor.fit_transform"></a>

#### fit_transform(X, y=None, \*\*fit_params)

Return a constant exposure matrix.

* **Parameters:**
  **X** *AssetPanel*
  : Input panel used to determine the number of observations and assets.

  **y** *None*
  : Ignored. Present for compatibility with scikit-learn’s API.

  **\*\*fit_params** *dict*
  : Additional fit parameters. They are ignored.
* **Returns:**
  **exposure** *ndarray of shape (n_observations, n_assets)*
  : Constant factor exposure equal to one for every asset in every observation.

<a id="skfolio.factor_exposure.GlobalFactor.get_metadata_routing"></a>

#### get_metadata_routing()

Get metadata routing of this object.

Please check [User Guide](https://skfolio.org/user_guide/metadata_routing.html.md#metadata-routing) on how the routing
mechanism works.

* **Returns:**
  **routing** *MetadataRequest*
  : A `MetadataRequest` encapsulating
    routing information.

<a id="skfolio.factor_exposure.GlobalFactor.get_params"></a>

#### get_params(deep=True)

Get parameters for this estimator.

* **Parameters:**
  **deep** *bool, default=True*
  : If True, will return the parameters for this estimator and
    contained subobjects that are estimators.
* **Returns:**
  **params** *dict*
  : Parameter names mapped to their values.

<a id="skfolio.factor_exposure.GlobalFactor.partial_fit_transform"></a>

#### partial_fit_transform(X, y=None, \*\*fit_params)

Stateless class delegation to `fit_transform`.

<a id="skfolio.factor_exposure.GlobalFactor.set_params"></a>

#### set_params(\*\*params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects
(such as `Pipeline`). The latter have
parameters of the form `<component>__<parameter>` so that it’s
possible to update each component of a nested object.

* **Parameters:**
  **\*\*params** *dict*
  : Estimator parameters.
* **Returns:**
  **self** *estimator instance*
  : Estimator instance.

