autogluon.common.features.feature_metadata.FeatureMetadata

class autogluon.common.features.feature_metadata.FeatureMetadata(type_map_raw: Dict[str, str], type_group_map_special: Dict[str, List[str]] = None, type_map_special: Dict[str, List[str]] = None)[source]

特征元数据包含有关在原始数据本身中不直接显现的特征的信息。 这使得特征生成器能够正确处理特征,并允许下游模型在训练和推理过程中正确处理特征。

Parameters:
  • type_map_raw (Dict[str, str]) –

    特征名称到原始类型的字典。 值可以是任何内容,但通常建议它们是以下之一:

    [‘int’, ‘float’, ‘object’, ‘category’, ‘datetime’]

  • type_group_map_special (Dict[str, List[str]], optional) –

    特殊类型到特征名称列表的字典。 键可以是任何内容,但通常建议它们是以下之一:

    [‘binned’, ‘datetime_as_int’, ‘datetime_as_object’, ‘text’, ‘text_as_category’, ‘text_special’, ‘text_ngram’, ‘image_path’, ‘stack’]

    有关每种特殊特征类型的描述,请参见:autogluon.common.features.types 出现在值列表中的特征名称也必须是type_map_raw中的键。 特征名称不需要具有特殊类型。 只能指定type_group_map_special和type_map_special中的一个。

  • type_map_special (Dict[str, List[str]], optional) – 特征名称到特殊类型列表的字典。 这是特殊类型的另一种表示方式。 只能指定type_group_map_special和type_map_special中的一个。

__init__(type_map_raw: Dict[str, str], type_group_map_special: Dict[str, List[str]] = None, type_map_special: Dict[str, List[str]] = None)[source]

方法

add_special_types

向特征添加特殊类型。

from_df

Construct FeatureMetadata based on the inferred feature types of an input pd.DataFrame.

get_feature_type_raw

get_feature_types_special

get_features

返回通过可用参数修剪后,特征元数据对象中包含的特征列表。

get_type_group_map_raw

get_type_group_map_special_from_type_map_special

get_type_map_special

join_metadata

将两个FeatureMetadata对象连接在一起,返回一个新的FeatureMetadata对象

join_metadatas

keep_features

从元数据中移除所有特征,只保留features中的特征

print_feature_metadata_full

remove_features

从元数据中移除所有在features中的特征

rename_features

将元数据中所有在rename_map中作为键的特征重命名为它们的值。

to_dict

verify_data

如果DataFrame的原始类型与FeatureMetadata匹配,则返回True,否则返回False

verify_data_subset

如果DataFrame的特征是FeatureMetadata的子集并且其原始类型与FeatureMetadata匹配,则返回True,否则返回False

verify_data_superset

如果DataFrame的特征是FeatureMetadata的超集并且其原始类型与FeatureMetadata匹配,则返回True,否则返回False