featuretools.load_features#

featuretools.load_features(features, profile_name=None)[source]#

从文件路径、S3 路径、URL、打开的文件或 JSON 格式字符串加载特征。

参数:
  • features (str 或 FileObject) – 保存特征的文件位置。

  • file (这必须是文件名,) –

  • string (JSON 格式字符串,) –

  • handle. (或可读的文件句柄。) –

  • profile_name (str, bool) – 指定用于写入 S3 的 AWS 配置文件。默认为 None,并搜索 AWS 凭据。设置为 False 以使用匿名配置文件。

返回:

特征定义列表。

返回类型:

features (list[FeatureBase])

注意

在 Featuretools 或 Python 的一个版本中保存的特征不能保证在另一个版本中可用。升级 Featuretools 或 Python 后,可能需要重新生成特征。

示例

# Option 1
filepath = os.path.join('/Home/features/', 'list.json')
features = ft.load_features(filepath)

# Option 2
filepath = os.path.join('/Home/features/', 'list.json')
with open(filepath, 'r') as f:
    features = ft.load_features(f)

# Option 3
filepath = os.path.join('/Home/features/', 'list.json')
with open(filepath, 'r') as :
    feature_str = f.read()
features = ft.load_features(feature_str)

另请参阅

save_features()