class_docstr: Create a FeatureCollection.
  
  Parameters
  ----------
  feature_descriptors : Union[FeatureDescriptor, MultipleFeatureDescriptors, FeatureCollection, List[Union[FeatureDescriptor, MultipleFeatureDescriptors, FeatureCollection]]], optional
      Initial (list of) feature(s) to add to collection, by default None
  
  Notes
  -----
  * The `series_name` property of the `FeatureDescriptor`s should **not withhold a "|"
    character**, since "|" is used to join the series names of features which use
    multiple series as input).<br>
    e.g.<br>
      * `ACC|x` is **not** allowed as series name, as this is ambiguous and could
        represent that this feature is constructed with a combination of the `ACC`
        and `x` signal.<br>
        Note that `max|feat` is allowed as feature output name.
  * Both the `series_name` and `output_name` property of the `FeatureDescriptor`s
    **should not withhold "__"** in its string representations. This constraint is
    mainly made for readability purposes.
  
  The two statements above will be asserted
docstr: Create a reduced FeatureCollection instance based on `feat_cols_to_keep`.
  
  For example, this is useful to optimize feature-extraction inference
  (for your selected features) after performing a feature-selection procedure.
  
  Parameters
  ----------
  feat_cols_to_keep: List[str]
      A subset of the feature collection instance its column names.
      This corresponds to the columns / names of the output from `calculate`
      method that you want to keep.
  
  Returns
  -------
  FeatureCollection
      A new FeatureCollection object, which only withholds the FeatureDescriptors
      which constitute the `feat_cols_to_keep` output.
  
  Note
  ----
  Some FeatureDescriptor objects may have multiple **output-names**.<br>
  Hence, if you only want to retain _a subset_ of that FeatureDescriptor its
  feature outputs, you will still get **all features** as the new
  FeatureCollection is constructed by applying a filter on de FeatureDescriptor
  list and we thus not alter these FeatureDescriptor objects themselves.
docstr_tok: ["Create","a","reduced","FeatureCollection","instance","based","on","`","feat_cols_to_keep","`",".","For","example",",","this","is","useful","to","optimize","feature-extraction","inference","(","for","your","selected","features",")","after","performing","a","feature-selection","procedure",".","Parameters","--","--","--","--","--","feat_cols_to_keep",":","List","[","str","]","A","subset","of","the","feature","collection","instance","its","column","names",".","This","corresponds","to","the","columns","\/","names","of","the","output","from","`","calculate","`","method","that","you","want","to","keep",".","Returns","--","--","--","-","FeatureCollection","A","new","FeatureCollection","object",",","which","only","withholds","the","FeatureDescriptors","which","constitute","the","`","feat_cols_to_keep","`","output",".","Note","--","--","Some","FeatureDescriptor","objects","may","have","multiple","*","*","output-names","*","*",".","<","br",">","Hence",",","if","you","only","want","to","retain","_a","subset_","of","that","FeatureDescriptor","its","feature","outputs",",","you","will","still","get","*","*","all","features","*","*","as","the","new","FeatureCollection","is","constructed","by","applying","a","filter","on","de","FeatureDescriptor","list","and","we","thus","not","alter","these","FeatureDescriptor","objects","themselves","."]
code: def reduce(self, feat_cols_to_keep: List[str]) -> FeatureCollection:
      """Create a reduced FeatureCollection instance based on `feat_cols_to_keep`.
  
      For example, this is useful to optimize feature-extraction inference
      (for your selected features) after performing a feature-selection procedure.
  
      Parameters
      ----------
      feat_cols_to_keep: List[str]
          A subset of the feature collection instance its column names.
          This corresponds to the columns / names of the output from `calculate`
          method that you want to keep.
  
      Returns
      -------
      FeatureCollection
          A new FeatureCollection object, which only withholds the FeatureDescriptors
          which constitute the `feat_cols_to_keep` output.
  
      Note
      ----
      Some FeatureDescriptor objects may have multiple **output-names**.<br>
      Hence, if you only want to retain _a subset_ of that FeatureDescriptor its
      feature outputs, you will still get **all features** as the new
      FeatureCollection is constructed by applying a filter on de FeatureDescriptor
      list and we thus not alter these FeatureDescriptor objects themselves.
  
      """
      # dict in which we store all the { output_col_name : (UUID, FeatureDescriptor) }
      # items of our current FeatureCollection object
      manual_window = False
      if any(c.endswith("w=manual") for c in feat_cols_to_keep):
          assert all(c.endswith("w=manual") for c in feat_cols_to_keep)
          # As the windows are created manual, the FeatureCollection cannot contain
          # multiple windows for the same output name - input_series combination
          self._check_no_multiple_windows()
          manual_window = True
      feat_col_fd_mapping: Dict[str, Tuple[str, FeatureDescriptor]] = {}
      for (s_names, window), fd_list in self._feature_desc_dict.items():
          window = (
              "manual" if manual_window else self._ws_to_str(window)
          )
          for fd in fd_list:
              # As a single FeatureDescriptor can have multiple output col names, we
              # create a unique identifier for each FeatureDescriptor (on which we
              # will apply set-like operations later on to only retain all the unique
              # FeatureDescriptors)
              uuid_str = str(uuid.uuid4())
              for output_name in fd.function.output_names:
                  # Reconstruct the feature column name
                  feat_col_name = StridedRolling.construct_output_index(
                      series_keys=s_names,
                      feat_name=output_name,
                      win_str=window,
                  )
                  feat_col_fd_mapping[feat_col_name] = (uuid_str, fd)
  
      assert all(fc in feat_col_fd_mapping for fc in feat_cols_to_keep)
  
      # Collect (uuid, FeatureDescriptor) for the feat_cols_to_keep
      fd_subset: List[Tuple[str, FeatureDescriptor]] = [
          feat_col_fd_mapping[fc] for fc in feat_cols_to_keep
      ]
  
      # Reduce to unique feature descriptor objects (based on uuid) and create a new
      # FeatureCollection for their deepcopy's.
      seen_uuids = set()
      return FeatureCollection(
          feature_descriptors=[
              deepcopy(unique_fd)
              for unique_fd in {
                  fd
                  for (uuid_str, fd) in fd_subset
                  if uuid_str not in seen_uuids
                  and not seen_uuids.add(uuid_str)
              }
          ]
      )
  
imports: from __future__ import annotations
  import warnings
  import os
  import traceback
  import uuid
  from copy import deepcopy
  from pathlib import Path
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
  import dill
  import numpy
  import pandas
  from multiprocess import Pool
  from tqdm.auto import tqdm
  from ..features.function_wrapper import FuncWrapper
  from ..utils.attribute_parsing import AttributeParser
  from ..utils.data import flatten, to_list, to_series_list
  from ..utils.logging import add_logging_handler, delete_logging_handlers
  from ..utils.time import parse_time_arg, timedelta_to_str
  from .feature import FeatureDescriptor, MultipleFeatureDescriptors
  from .logger import logger
  from .segmenter import StridedRolling, StridedRollingFactory
  from .utils import _check_start_end_array, _determine_bounds
label_desc: Use image node_id 16 for calling the FeatureCollection obj's underlying member method code with example usage: obj.reduce(feat_cols_to_keep) and returns: FeatureCollection