featuretools.computational_backends.calculate_feature_matrix

featuretools.computational_backends.calculate_feature_matrix(features, entityset=None, cutoff_time=None, instance_ids=None, entities=None, relationships=None, cutoff_time_in_index=False, training_window=None, approximate=None, save_progress=None, verbose=False, chunk_size=None, n_jobs=1, dask_kwargs=None, profile=False)

Calculates a matrix for a given set of instance ids and calculation times.

Parameters:
  • features (list[PrimitiveBase]) – Feature definitions to be calculated.
  • entityset (EntitySet) – An already initialized entityset. Required if entities and relationships not provided
  • cutoff_time (pd.DataFrame or Datetime) – Specifies at which time to calculate the features for each instance. Can either be a DataFrame with ‘instance_id’ and ‘time’ columns, DataFrame with the name of the index variable in the target entity and a time column, or a single value to calculate for all instances. If the dataframe has more than two columns, any additional columns will be added to the resulting feature matrix.
  • instance_ids (list) – List of instances to calculate features on. Only used if cutoff_time is a single datetime.
  • entities (dict[str -> tuple(pd.DataFrame, str, str)]) – dictionary of entities. Entries take the format {entity id: (dataframe, id column, (time_column))}.
  • relationships (list[(str, str, str, str)]) – list of relationships between entities. List items are a tuple with the format (parent entity id, parent variable, child entity id, child variable).
  • cutoff_time_in_index (bool) – If True, return a DataFrame with a MultiIndex where the second index is the cutoff time (first is instance id). DataFrame will be sorted by (time, instance_id).
  • training_window (Timedelta, optional) – Window defining how much older than the cutoff time data can be to be included when calculating the feature. If None, all older data is used.
  • approximate (Timedelta or str) – Frequency to group instances with similar cutoff times by for features with costly calculations. For example, if bucket is 24 hours, all instances with cutoff times on the same day will use the same calculation for expensive features.
  • verbose (bool, optional) – Print progress info. The time granularity is per chunk.
  • profile (bool, optional) – Enables profiling if True.
  • chunk_size (int or float or None or "cutoff time") – Number of rows of output feature matrix to calculate at time. If passed an integer greater than 0, will try to use that many rows per chunk. If passed a float value between 0 and 1 sets the chunk size to that percentage of all instances. If passed the string “cutoff time”, rows are split per cutoff time.
  • n_jobs (int, optional) – number of parallel processes to use when calculating feature matrix
  • dask_kwargs (dict, optional) –

    Dictionary of keyword arguments to be passed when creating the dask client and scheduler. Even if n_jobs is not set, using dask_kwargs will enable multiprocessing. Main parameters:

    cluster (str or dask.distributed.LocalCluster):
    cluster or address of cluster to send tasks to. If unspecified, a cluster will be created.
    diagnostics port (int):
    port number to use for web dashboard. If left unspecified, web interface will not be enabled.

    Valid keyword arguments for LocalCluster will also be accepted.

  • save_progress (str, optional) – path to save intermediate computational results.