nodes: 0, module; 1, function_definition; 2, function_name:extract_relevant_features; 3, parameters; 4, block; 5, identifier:timeseries_container; 6, identifier:y; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_parameter; 16, default_parameter; 17, default_parameter; 18, default_parameter; 19, default_parameter; 20, default_parameter; 21, default_parameter; 22, default_parameter; 23, default_parameter; 24, default_parameter; 25, default_parameter; 26, default_parameter; 27, default_parameter; 28, expression_statement; 29, assert_statement; 30, assert_statement; 31, if_statement; 32, expression_statement; 33, expression_statement; 34, if_statement; 35, expression_statement; 36, expression_statement; 37, if_statement; 38, return_statement; 39, identifier:X; 40, None; 41, identifier:default_fc_parameters; 42, None; 43, identifier:kind_to_fc_parameters; 44, None; 45, identifier:column_id; 46, None; 47, identifier:column_sort; 48, None; 49, identifier:column_kind; 50, None; 51, identifier:column_value; 52, None; 53, identifier:show_warnings; 54, attribute; 55, identifier:disable_progressbar; 56, attribute; 57, identifier:profile; 58, attribute; 59, identifier:profiling_filename; 60, attribute; 61, identifier:profiling_sorting; 62, attribute; 63, identifier:test_for_binary_target_binary_feature; 64, attribute; 65, identifier:test_for_binary_target_real_feature; 66, attribute; 67, identifier:test_for_real_target_binary_feature; 68, attribute; 69, identifier:test_for_real_target_real_feature; 70, attribute; 71, identifier:fdr_level; 72, attribute; 73, identifier:hypotheses_independent; 74, attribute; 75, identifier:n_jobs; 76, attribute; 77, identifier:chunksize; 78, attribute; 79, identifier:ml_task; 80, string; 81, comment:"""
      High level convenience function to extract time series features from `timeseries_container`. Then return feature
      matrix `X` possibly augmented with relevant features with respect to target vector `y`.
  
      For more details see the documentation of :func:`~tsfresh.feature_extraction.extraction.extract_features` and
      :func:`~tsfresh.feature_selection.selection.select_features`.
  
      Examples
      ========
  
      >>> from tsfresh.examples import load_robot_execution_failures
      >>> from tsfresh import extract_relevant_features
      >>> df, y = load_robot_execution_failures()
      >>> X = extract_relevant_features(df, y, column_id='id', column_sort='time')
  
      :param timeseries_container: The pandas.DataFrame with the time series to compute the features for, or a
              dictionary of pandas.DataFrames.
              See :func:`~tsfresh.feature_extraction.extraction.extract_features`.
  
      :param X: A DataFrame containing additional features
      :type X: pandas.DataFrame
  
      :param y: The target vector
      :type y: pandas.Series
  
      :param default_fc_parameters: mapping from feature calculator names to parameters. Only those names
             which are keys in this dict will be calculated. See the class:`ComprehensiveFCParameters` for
             more information.
      :type default_fc_parameters: dict
  
      :param kind_to_fc_parameters: mapping from kind names to objects of the same type as the ones for
              default_fc_parameters. If you put a kind as a key here, the fc_parameters
              object (which is the value), will be used instead of the default_fc_parameters.
      :type kind_to_fc_parameters: dict
  
      :param column_id: The name of the id column to group by.
      :type column_id: str
  
      :param column_sort: The name of the sort column.
      :type column_sort: str
  
      :param column_kind: The name of the column keeping record on the kind of the value.
      :type column_kind: str
  
      :param column_value: The name for the column keeping the value itself.
      :type column_value: str
  
      :param chunksize: The size of one chunk that is submitted to the worker
          process for the parallelisation.  Where one chunk is defined as a
          singular time series for one id and one kind. If you set the chunksize
          to 10, then it means that one task is to calculate all features for 10
          time series.  If it is set it to None, depending on distributor,
          heuristics are used to find the optimal chunksize. If you get out of
          memory exceptions, you can try it with the dask distributor and a
          smaller chunksize.
      :type chunksize: None or int
  
      :param n_jobs: The number of processes to use for parallelization. If zero, no parallelization is used.
      :type n_jobs: int
  
      :param: show_warnings: Show warnings during the feature extraction (needed for debugging of calculators).
      :type show_warnings: bool
  
      :param disable_progressbar: Do not show a progressbar while doing the calculation.
      :type disable_progressbar: bool
  
      :param profile: Turn on profiling during feature extraction
      :type profile: bool
  
      :param profiling_sorting: How to sort the profiling results (see the documentation of the profiling package for
             more information)
      :type profiling_sorting: basestring
  
      :param profiling_filename: Where to save the profiling results.
      :type profiling_filename: basestring
  
      :param test_for_binary_target_binary_feature: Which test to be used for binary target, binary feature (currently unused)
      :type test_for_binary_target_binary_feature: str
  
      :param test_for_binary_target_real_feature: Which test to be used for binary target, real feature
      :type test_for_binary_target_real_feature: str
  
      :param test_for_real_target_binary_feature: Which test to be used for real target, binary feature (currently unused)
      :type test_for_real_target_binary_feature: str
  
      :param test_for_real_target_real_feature: Which test to be used for real target, real feature (currently unused)
      :type test_for_real_target_real_feature: str
  
      :param fdr_level: The FDR level that should be respected, this is the theoretical expected percentage of irrelevant
                        features among all created features.
      :type fdr_level: float
  
      :param hypotheses_independent: Can the significance of the features be assumed to be independent?
                                     Normally, this should be set to False as the features are never
                                     independent (e.g. mean and median)
      :type hypotheses_independent: bool
  
      :param ml_task: The intended machine learning task. Either `'classification'`, `'regression'` or `'auto'`.
                      Defaults to `'auto'`, meaning the intended task is inferred from `y`.
                      If `y` has a boolean, integer or object dtype, the task is assumend to be classification,
                      else regression.
      :type ml_task: str
  
      :return: Feature matrix X, possibly extended with relevant time series features.
      """; 82, call; 83, call; 84, comparison_operator:len(set(y)) > 1; 85, string:"Feature selection is only possible if more than 1 label/class is provided"; 86, comparison_operator:X is not None; 87, block; 88, assignment; 89, assignment; 90, comparison_operator:ids_container != ids_y; 91, block; 92, assignment; 93, assignment; 94, comparison_operator:X is None; 95, block; 96, else_clause; 97, identifier:X; 98, identifier:defaults; 99, identifier:SHOW_WARNINGS; 100, identifier:defaults; 101, identifier:DISABLE_PROGRESSBAR; 102, identifier:defaults; 103, identifier:PROFILING; 104, identifier:defaults; 105, identifier:PROFILING_FILENAME; 106, identifier:defaults; 107, identifier:PROFILING_SORTING; 108, identifier:defaults; 109, identifier:TEST_FOR_BINARY_TARGET_BINARY_FEATURE; 110, identifier:defaults; 111, identifier:TEST_FOR_BINARY_TARGET_REAL_FEATURE; 112, identifier:defaults; 113, identifier:TEST_FOR_REAL_TARGET_BINARY_FEATURE; 114, identifier:defaults; 115, identifier:TEST_FOR_REAL_TARGET_REAL_FEATURE; 116, identifier:defaults; 117, identifier:FDR_LEVEL; 118, identifier:defaults; 119, identifier:HYPOTHESES_INDEPENDENT; 120, identifier:defaults; 121, identifier:N_PROCESSES; 122, identifier:defaults; 123, identifier:CHUNKSIZE; 124, string_content:auto; 125, identifier:isinstance; 126, argument_list; 127, attribute; 128, argument_list; 129, call; 130, integer:1; 131, identifier:X; 132, None; 133, expression_statement; 134, identifier:ids_container; 135, call; 136, identifier:ids_y; 137, call; 138, identifier:ids_container; 139, identifier:ids_y; 140, if_statement; 141, if_statement; 142, identifier:X_ext; 143, call; 144, identifier:X_sel; 145, call; 146, identifier:X; 147, None; 148, expression_statement; 149, block; 150, identifier:y; 151, attribute; 152, string:"y needs to be a pandas.Series, received type: {}."; 153, identifier:format; 154, call; 155, identifier:len; 156, argument_list; 157, assignment; 158, identifier:get_ids; 159, argument_list; 160, identifier:set; 161, argument_list; 162, comparison_operator:len(ids_container - ids_y) > 0; 163, block; 164, comparison_operator:len(ids_y - ids_container) > 0; 165, block; 166, identifier:extract_features; 167, argument_list; 168, identifier:select_features; 169, argument_list; 170, assignment; 171, expression_statement; 172, identifier:pd; 173, identifier:Series; 174, identifier:type; 175, argument_list; 176, call; 177, identifier:timeseries_container; 178, call; 179, keyword_argument; 180, keyword_argument; 181, attribute; 182, call; 183, integer:0; 184, raise_statement; 185, call; 186, integer:0; 187, raise_statement; 188, identifier:timeseries_container; 189, keyword_argument; 190, keyword_argument; 191, keyword_argument; 192, keyword_argument; 193, keyword_argument; 194, keyword_argument; 195, keyword_argument; 196, keyword_argument; 197, keyword_argument; 198, keyword_argument; 199, keyword_argument; 200, keyword_argument; 201, keyword_argument; 202, identifier:X_ext; 203, identifier:y; 204, keyword_argument; 205, keyword_argument; 206, keyword_argument; 207, keyword_argument; 208, keyword_argument; 209, keyword_argument; 210, keyword_argument; 211, keyword_argument; 212, keyword_argument; 213, identifier:X; 214, identifier:X_sel; 215, assignment; 216, identifier:y; 217, identifier:set; 218, argument_list; 219, identifier:restrict_input_to_index; 220, argument_list; 221, identifier:df_or_dict; 222, identifier:timeseries_container; 223, identifier:column_id; 224, identifier:column_id; 225, identifier:y; 226, identifier:index; 227, identifier:len; 228, argument_list; 229, call; 230, identifier:len; 231, argument_list; 232, call; 233, identifier:default_fc_parameters; 234, identifier:default_fc_parameters; 235, identifier:kind_to_fc_parameters; 236, identifier:kind_to_fc_parameters; 237, identifier:show_warnings; 238, identifier:show_warnings; 239, identifier:disable_progressbar; 240, identifier:disable_progressbar; 241, identifier:profile; 242, identifier:profile; 243, identifier:profiling_filename; 244, identifier:profiling_filename; 245, identifier:profiling_sorting; 246, identifier:profiling_sorting; 247, identifier:n_jobs; 248, identifier:n_jobs; 249, identifier:column_id; 250, identifier:column_id; 251, identifier:column_sort; 252, identifier:column_sort; 253, identifier:column_kind; 254, identifier:column_kind; 255, identifier:column_value; 256, identifier:column_value; 257, identifier:impute_function; 258, identifier:impute; 259, identifier:test_for_binary_target_binary_feature; 260, identifier:test_for_binary_target_binary_feature; 261, identifier:test_for_binary_target_real_feature; 262, identifier:test_for_binary_target_real_feature; 263, identifier:test_for_real_target_binary_feature; 264, identifier:test_for_real_target_binary_feature; 265, identifier:test_for_real_target_real_feature; 266, identifier:test_for_real_target_real_feature; 267, identifier:fdr_level; 268, identifier:fdr_level; 269, identifier:hypotheses_independent; 270, identifier:hypotheses_independent; 271, identifier:n_jobs; 272, identifier:n_jobs; 273, identifier:chunksize; 274, identifier:chunksize; 275, identifier:ml_task; 276, identifier:ml_task; 277, identifier:X; 278, call; 279, identifier:y; 280, identifier:timeseries_container; 281, identifier:column_id; 282, attribute; 283, binary_operator:ids_container - ids_y; 284, identifier:ValueError; 285, argument_list; 286, binary_operator:ids_y - ids_container; 287, identifier:ValueError; 288, argument_list; 289, attribute; 290, argument_list; 291, identifier:X; 292, identifier:index; 293, identifier:ids_container; 294, identifier:ids_y; 295, call; 296, identifier:ids_y; 297, identifier:ids_container; 298, call; 299, identifier:pd; 300, identifier:merge; 301, identifier:X; 302, identifier:X_sel; 303, keyword_argument; 304, keyword_argument; 305, keyword_argument; 306, attribute; 307, argument_list; 308, attribute; 309, argument_list; 310, identifier:left_index; 311, True; 312, identifier:right_index; 313, True; 314, identifier:how; 315, string:"left"; 316, concatenated_string; 317, identifier:format; 318, binary_operator:ids_container - ids_y; 319, concatenated_string; 320, identifier:format; 321, binary_operator:ids_y - ids_container; 322, string:"The following ids are in the time series container but are missing in y: "; 323, string:"{}"; 324, identifier:ids_container; 325, identifier:ids_y; 326, string:"The following ids are in y but are missing inside the time series container: "; 327, string:"{}"; 328, identifier:ids_y; 329, identifier:ids_container
code: def extract_relevant_features(timeseries_container, y, X=None,
                                default_fc_parameters=None,
                                kind_to_fc_parameters=None,
                                column_id=None, column_sort=None, column_kind=None, column_value=None,
                                show_warnings=defaults.SHOW_WARNINGS,
                                disable_progressbar=defaults.DISABLE_PROGRESSBAR,
                                profile=defaults.PROFILING,
                                profiling_filename=defaults.PROFILING_FILENAME,
                                profiling_sorting=defaults.PROFILING_SORTING,
                                test_for_binary_target_binary_feature=defaults.TEST_FOR_BINARY_TARGET_BINARY_FEATURE,
                                test_for_binary_target_real_feature=defaults.TEST_FOR_BINARY_TARGET_REAL_FEATURE,
                                test_for_real_target_binary_feature=defaults.TEST_FOR_REAL_TARGET_BINARY_FEATURE,
                                test_for_real_target_real_feature=defaults.TEST_FOR_REAL_TARGET_REAL_FEATURE,
                                fdr_level=defaults.FDR_LEVEL,
                                hypotheses_independent=defaults.HYPOTHESES_INDEPENDENT,
                                n_jobs=defaults.N_PROCESSES,
                                chunksize=defaults.CHUNKSIZE,
                                ml_task='auto'):
      """
      High level convenience function to extract time series features from `timeseries_container`. Then return feature
      matrix `X` possibly augmented with relevant features with respect to target vector `y`.
  
      For more details see the documentation of :func:`~tsfresh.feature_extraction.extraction.extract_features` and
      :func:`~tsfresh.feature_selection.selection.select_features`.
  
      Examples
      ========
  
      >>> from tsfresh.examples import load_robot_execution_failures
      >>> from tsfresh import extract_relevant_features
      >>> df, y = load_robot_execution_failures()
      >>> X = extract_relevant_features(df, y, column_id='id', column_sort='time')
  
      :param timeseries_container: The pandas.DataFrame with the time series to compute the features for, or a
              dictionary of pandas.DataFrames.
              See :func:`~tsfresh.feature_extraction.extraction.extract_features`.
  
      :param X: A DataFrame containing additional features
      :type X: pandas.DataFrame
  
      :param y: The target vector
      :type y: pandas.Series
  
      :param default_fc_parameters: mapping from feature calculator names to parameters. Only those names
             which are keys in this dict will be calculated. See the class:`ComprehensiveFCParameters` for
             more information.
      :type default_fc_parameters: dict
  
      :param kind_to_fc_parameters: mapping from kind names to objects of the same type as the ones for
              default_fc_parameters. If you put a kind as a key here, the fc_parameters
              object (which is the value), will be used instead of the default_fc_parameters.
      :type kind_to_fc_parameters: dict
  
      :param column_id: The name of the id column to group by.
      :type column_id: str
  
      :param column_sort: The name of the sort column.
      :type column_sort: str
  
      :param column_kind: The name of the column keeping record on the kind of the value.
      :type column_kind: str
  
      :param column_value: The name for the column keeping the value itself.
      :type column_value: str
  
      :param chunksize: The size of one chunk that is submitted to the worker
          process for the parallelisation.  Where one chunk is defined as a
          singular time series for one id and one kind. If you set the chunksize
          to 10, then it means that one task is to calculate all features for 10
          time series.  If it is set it to None, depending on distributor,
          heuristics are used to find the optimal chunksize. If you get out of
          memory exceptions, you can try it with the dask distributor and a
          smaller chunksize.
      :type chunksize: None or int
  
      :param n_jobs: The number of processes to use for parallelization. If zero, no parallelization is used.
      :type n_jobs: int
  
      :param: show_warnings: Show warnings during the feature extraction (needed for debugging of calculators).
      :type show_warnings: bool
  
      :param disable_progressbar: Do not show a progressbar while doing the calculation.
      :type disable_progressbar: bool
  
      :param profile: Turn on profiling during feature extraction
      :type profile: bool
  
      :param profiling_sorting: How to sort the profiling results (see the documentation of the profiling package for
             more information)
      :type profiling_sorting: basestring
  
      :param profiling_filename: Where to save the profiling results.
      :type profiling_filename: basestring
  
      :param test_for_binary_target_binary_feature: Which test to be used for binary target, binary feature (currently unused)
      :type test_for_binary_target_binary_feature: str
  
      :param test_for_binary_target_real_feature: Which test to be used for binary target, real feature
      :type test_for_binary_target_real_feature: str
  
      :param test_for_real_target_binary_feature: Which test to be used for real target, binary feature (currently unused)
      :type test_for_real_target_binary_feature: str
  
      :param test_for_real_target_real_feature: Which test to be used for real target, real feature (currently unused)
      :type test_for_real_target_real_feature: str
  
      :param fdr_level: The FDR level that should be respected, this is the theoretical expected percentage of irrelevant
                        features among all created features.
      :type fdr_level: float
  
      :param hypotheses_independent: Can the significance of the features be assumed to be independent?
                                     Normally, this should be set to False as the features are never
                                     independent (e.g. mean and median)
      :type hypotheses_independent: bool
  
      :param ml_task: The intended machine learning task. Either `'classification'`, `'regression'` or `'auto'`.
                      Defaults to `'auto'`, meaning the intended task is inferred from `y`.
                      If `y` has a boolean, integer or object dtype, the task is assumend to be classification,
                      else regression.
      :type ml_task: str
  
      :return: Feature matrix X, possibly extended with relevant time series features.
      """
  
      assert isinstance(y, pd.Series), "y needs to be a pandas.Series, received type: {}.".format(type(y))
      assert len(set(y)) > 1, "Feature selection is only possible if more than 1 label/class is provided"
  
      if X is not None:
          timeseries_container = restrict_input_to_index(timeseries_container, column_id, X.index)
  
      ids_container = get_ids(df_or_dict=timeseries_container, column_id=column_id)
      ids_y = set(y.index)
      if ids_container != ids_y:
          if len(ids_container - ids_y) > 0:
              raise ValueError("The following ids are in the time series container but are missing in y: "
                               "{}".format(ids_container - ids_y))
          if len(ids_y - ids_container) > 0:
              raise ValueError("The following ids are in y but are missing inside the time series container: "
                               "{}".format(ids_y - ids_container))
  
      X_ext = extract_features(timeseries_container,
                               default_fc_parameters=default_fc_parameters,
                               kind_to_fc_parameters=kind_to_fc_parameters,
                               show_warnings=show_warnings,
                               disable_progressbar=disable_progressbar,
                               profile=profile,
                               profiling_filename=profiling_filename,
                               profiling_sorting=profiling_sorting,
                               n_jobs=n_jobs,
                               column_id=column_id, column_sort=column_sort,
                               column_kind=column_kind, column_value=column_value,
                               impute_function=impute)
  
      X_sel = select_features(X_ext, y,
                              test_for_binary_target_binary_feature=test_for_binary_target_binary_feature,
                              test_for_binary_target_real_feature=test_for_binary_target_real_feature,
                              test_for_real_target_binary_feature=test_for_real_target_binary_feature,
                              test_for_real_target_real_feature=test_for_real_target_real_feature,
                              fdr_level=fdr_level, hypotheses_independent=hypotheses_independent,
                              n_jobs=n_jobs,
                              chunksize=chunksize,
                              ml_task=ml_task)
  
      if X is None:
          X = X_sel
      else:
          X = pd.merge(X, X_sel, left_index=True, right_index=True, how="left")
  
      return X