sort

Features.sort(by: Optional[str] = None, key: Optional[Callable[[Feature], Union[float, int, str]]] = None, descending: Optional[bool] = None) Features[source]

Sorts the Features container. If no arguments are provided the container is sorted by target and name.

Args:
by (str, optional):
The name of field to sort by. Possible fields:
  • name(s)

  • correlation(s)

  • importances(s)

key (callable, optional):

A callable that evaluates to a sort key for a given item.

descending (bool, optional):

Whether to sort in descending order.

Return:
getml.pipeline.Features:

A container of sorted Features.

Example:
by_correlation = my_pipeline.features.sort(by="correlation")

by_importance = my_pipeline.features.sort(key=lambda feature: feature.importance)