def from_columns(columns, columns_to_ignore=None):
    """
    Creates a mapping from kind names to fc_parameters objects
    (which are itself mappings from feature calculators to settings)
    to extract only the features contained in the columns.
    To do so, for every feature name in columns this method

    1. split the column name into col, feature, params part
    2. decide which feature we are dealing with (aggregate with/without params or apply)
    3. add it to the new name_to_function dict
    4. set up the params

    :param columns: containing the feature names
    :type columns: list of str
    :param columns_to_ignore: columns which do not contain tsfresh feature names
    :type columns_to_ignore: list of str

    :return: The kind_to_fc_parameters object ready to be used in the extract_features function.
    :rtype: dict
    """

    kind_to_fc_parameters = {}

    if columns_to_ignore is None:
        columns_to_ignore = []

    for col in columns:
        if col in columns_to_ignore:
            continue

        if not isinstance(col, basestring):
            raise TypeError("Column name {} should be a string or unicode".format(col))

        # Split according to our separator into <col_name>, <feature_name>, <feature_params>
        parts = col.split('__')
        n_parts = len(parts)

        if n_parts == 1:
            raise ValueError("Splitting of columnname {} resulted in only one part.".format(col))

        kind = parts[0]
        feature_name = parts[1]

        if kind not in kind_to_fc_parameters:
            kind_to_fc_parameters[kind] = {}

        if not hasattr(feature_calculators, feature_name):
            raise ValueError("Unknown feature name {}".format(feature_name))

        config = get_config_from_string(parts)
        if config:
            if feature_name in kind_to_fc_parameters[kind]:
                kind_to_fc_parameters[kind][feature_name].append(config)
            else:
                kind_to_fc_parameters[kind][feature_name] = [config]
        else:
            kind_to_fc_parameters[kind][feature_name] = None

    return kind_to_fc_parameters
def from_columns ( columns , columns_to_ignore = None ) : kind_to_fc_parameters = { } if columns_to_ignore is None : columns_to_ignore = [ ] for col in columns : if col in columns_to_ignore : continue if not isinstance ( col , basestring ) : raise TypeError ( "Column name {} should be a string or unicode" . format ( col ) ) parts = col . split ( '__' ) n_parts = len ( parts ) if n_parts == 1 : raise ValueError ( "Splitting of columnname {} resulted in only one part." . format ( col ) ) kind = parts [ 0 ] feature_name = parts [ 1 ] if kind not in kind_to_fc_parameters : kind_to_fc_parameters [ kind ] = { } if not hasattr ( feature_calculators , feature_name ) : raise ValueError ( "Unknown feature name {}" . format ( feature_name ) ) config = get_config_from_string ( parts ) if config : if feature_name in kind_to_fc_parameters [ kind ] : kind_to_fc_parameters [ kind ] [ feature_name ] . append ( config ) else : kind_to_fc_parameters [ kind ] [ feature_name ] = [ config ] else : kind_to_fc_parameters [ kind ] [ feature_name ] = None return kind_to_fc_parameters
Creates a mapping from kind names to fc_parameters objects
    (which are itself mappings from feature calculators to settings)
    to extract only the features contained in the columns.
    To do so, for every feature name in columns this method

    1. split the column name into col, feature, params part
    2. decide which feature we are dealing with (aggregate with/without params or apply)
    3. add it to the new name_to_function dict
    4. set up the params

    :param columns: containing the feature names
    :type columns: list of str
    :param columns_to_ignore: columns which do not contain tsfresh feature names
    :type columns_to_ignore: list of str

    :return: The kind_to_fc_parameters object ready to be used in the extract_features function.
    :rtype: dict