class_docstr: Calculates the values of a set of features for given instance ids.
docstr: Calculate values of features for the given instances of the target
  dataframe.
  
  Summary of algorithm:
  1. Construct a trie where the edges are relationships and each node
      contains a set of features for a single dataframe. See
      FeatureSet._build_feature_trie.
  2. Initialize a trie for storing dataframes.
  3. Traverse the trie using depth first search. At each node calculate
      the features and store the resulting dataframe in the dataframe
      trie (so that its values can be used by features which depend on
      these features). See _calculate_features_for_dataframe.
  4. Get the dataframe at the root of the trie (for the target dataframe) and
      return the columns corresponding to the requested features.
  
  Args:
      instance_ids (np.ndarray or pd.Categorical): Instance ids for which
          to build features.
  
      progress_callback (callable): function to be called with incremental progress updates
  
      include_cutoff_time (bool): If True, data at cutoff time are included
          in calculating features.
  
  Returns:
      pd.DataFrame : Pandas DataFrame of calculated feature values.
          Indexed by instance_ids. Columns in same order as features
          passed in.
docstr_tok: ["Calculate","values","of","features","for","the","given","instances","of","the","target","dataframe",".","Summary","of","algorithm",":","1",".","Construct","a","trie","where","the","edges","are","relationships","and","each","node","contains","a","set","of","features","for","a","single","dataframe",".","See","FeatureSet._build_feature_trie",".","2",".","Initialize","a","trie","for","storing","dataframes",".","3",".","Traverse","the","trie","using","depth","first","search",".","At","each","node","calculate","the","features","and","store","the","resulting","dataframe","in","the","dataframe","trie","(","so","that","its","values","can","be","used","by","features","which","depend","on","these","features",")",".","See","_calculate_features_for_dataframe",".","4",".","Get","the","dataframe","at","the","root","of","the","trie","(","for","the","target","dataframe",")","and","return","the","columns","corresponding","to","the","requested","features",".","Args",":","instance_ids","(","np.ndarray","or","pd.Categorical",")",":","Instance","ids","for","which","to","build","features",".","progress_callback","(","callable",")",":","function","to","be","called","with","incremental","progress","updates","include_cutoff_time","(","bool",")",":","If","True",",","data","at","cutoff","time","are","included","in","calculating","features",".","Returns",":","pd.DataFrame",":","Pandas","DataFrame","of","calculated","feature","values",".","Indexed","by","instance_ids",".","Columns","in","same","order","as","features","passed","in","."]
code: def run(
      self,
      instance_ids,
      progress_callback=None,
      include_cutoff_time=True,
  ):
      """
      Calculate values of features for the given instances of the target
      dataframe.
  
      Summary of algorithm:
      1. Construct a trie where the edges are relationships and each node
          contains a set of features for a single dataframe. See
          FeatureSet._build_feature_trie.
      2. Initialize a trie for storing dataframes.
      3. Traverse the trie using depth first search. At each node calculate
          the features and store the resulting dataframe in the dataframe
          trie (so that its values can be used by features which depend on
          these features). See _calculate_features_for_dataframe.
      4. Get the dataframe at the root of the trie (for the target dataframe) and
          return the columns corresponding to the requested features.
  
      Args:
          instance_ids (np.ndarray or pd.Categorical): Instance ids for which
              to build features.
  
          progress_callback (callable): function to be called with incremental progress updates
  
          include_cutoff_time (bool): If True, data at cutoff time are included
              in calculating features.
  
      Returns:
          pd.DataFrame : Pandas DataFrame of calculated feature values.
              Indexed by instance_ids. Columns in same order as features
              passed in.
      """
      assert len(instance_ids) > 0, "0 instance ids provided"
  
      if progress_callback is None:
          # do nothing for the progress call back if not provided
          def progress_callback(*args):
              pass
  
      feature_trie = self.feature_set.feature_trie
  
      df_trie = Trie(path_constructor=RelationshipPath)
      full_dataframe_trie = Trie(path_constructor=RelationshipPath)
  
      target_dataframe = self.entityset[self.feature_set.target_df_name]
  
      self._calculate_features_for_dataframe(
          dataframe_name=self.feature_set.target_df_name,
          feature_trie=feature_trie,
          df_trie=df_trie,
          full_dataframe_trie=full_dataframe_trie,
          precalculated_trie=self.precalculated_features,
          filter_column=target_dataframe.ww.index,
          filter_values=instance_ids,
          progress_callback=progress_callback,
          include_cutoff_time=include_cutoff_time,
      )
  
      # The dataframe for the target dataframe should be stored at the root of
      # df_trie.
      df = df_trie.value
  
      # Fill in empty rows with default values. This only works for pandas dataframes
      # and is not currently supported for Dask dataframes.
      if isinstance(df, pd.DataFrame):
          index_dtype = df.index.dtype.name
          if df.empty:
              return self.generate_default_df(instance_ids=instance_ids)
  
          missing_ids = [
              i
              for i in instance_ids
              if i not in df[target_dataframe.ww.index]
          ]
          if missing_ids:
              default_df = self.generate_default_df(
                  instance_ids=missing_ids,
                  extra_columns=df.columns,
              )
  
              df = pd.concat([df, default_df], sort=True)
  
          df.index.name = self.entityset[
              self.feature_set.target_df_name
          ].ww.index
  
          # Order by instance_ids
          unique_instance_ids = pd.unique(instance_ids)
          unique_instance_ids = unique_instance_ids.astype(
              instance_ids.dtype
          )
          df = df.reindex(unique_instance_ids)
  
          # Keep categorical index if original index was categorical
          if index_dtype == "category":
              df.index = df.index.astype("category")
  
      column_list = []
  
      for feat in self.feature_set.target_features:
          column_list.extend(feat.get_feature_names())
  
      if is_instance(df, (dd, ps), "DataFrame"):
          column_list.extend([target_dataframe.ww.index])
  
      return df[column_list]
  
imports: from datetime import datetime
  from functools import partial
  import numpy
  import pandas
  import pandas.api.types
  from featuretools.entityset.relationship import RelationshipPath
  from featuretools.exceptions import UnknownFeature
  from featuretools.feature_base import AggregationFeature, DirectFeature, GroupByTransformFeature, IdentityFeature, TransformFeature
  from featuretools.utils import Trie
  from featuretools.utils.gen_utils import Library, get_relationship_column_id, import_or_none, is_instance
label_desc: Use image node_id 2 for calling the FeatureSetCalculator obj's underlying member method code with example usage: obj.run(instance_ids, progress_callback, include_cutoff_time) and returns: df, self