featuretools.load_features#

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

Loads the features from a filepath, S3 path, URL, an open file, or a JSON formatted string.

Parameters:
  • features (str or FileObject) – 保存特征的文件位置.

  • 这必须是文件名、JSON格式字符串或可读文件句柄之一.

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

Returns:

特征定义列表.

Return type:

features (list[FeatureBase])

Note

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

Example

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

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

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

See also

save_features()