Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon s3 功能工具能否将功能列表直接保存到s3?_Amazon S3_Featuretools - Fatal编程技术网

Amazon s3 功能工具能否将功能列表直接保存到s3?

Amazon s3 功能工具能否将功能列表直接保存到s3?,amazon-s3,featuretools,Amazon S3,Featuretools,我正试图将深度特性合成返回的特性列表直接保存到S3。如果在本地持久化,我可以使用“ft.save_features(features,pathtofile)”。是否要将S3URL传递给此方法?现在,它只能写入本地磁盘。如果您想保存到S3并稍后从S3下载,您可以通过这样将文件写入磁盘和从磁盘中写入来实现 import featuretools as ft import boto es = ft.demo.load_mock_customer(return_entityset=True) fea

我正试图将深度特性合成返回的特性列表直接保存到S3。如果在本地持久化,我可以使用“ft.save_features(features,pathtofile)”。是否要将S3URL传递给此方法?

现在,它只能写入本地磁盘。如果您想保存到S3并稍后从S3下载,您可以通过这样将文件写入磁盘和从磁盘中写入来实现

import featuretools as ft
import boto

es = ft.demo.load_mock_customer(return_entityset=True)

feature_defs = ft.dfs(entityset=es,
                      target_entity="customers",
                      agg_primitives=["count"],
                      trans_primitives=["month"],
                      max_depth=1,
                      features_only=True)

# save features to disk
saved_features_file = "feature_defs"
ft.save_features(feature_defs, saved_features_file)

# upload to s3
s3_connection = boto.connect_s3()
bucket = s3_connection.get_bucket('featuretools-static')
key = boto.s3.key.Key(bucket, saved_features_file)
key.set_contents_from_filename(saved_features_file)

# download from s3
downloaded_features_file = "feature_defs_downloaded"
key.get_contents_to_filename(downloaded_features_file)
feature_defs_s3 = ft.load_features(downloaded_features_file)

# test to make sure it works
feature_matrix = ft.calculate_feature_matrix(entityset=es, features=feature_defs_s3)

现在,它只能写入本地磁盘。如果您想保存到S3并稍后从S3下载,您可以通过这样将文件写入磁盘和从磁盘中写入来实现

import featuretools as ft
import boto

es = ft.demo.load_mock_customer(return_entityset=True)

feature_defs = ft.dfs(entityset=es,
                      target_entity="customers",
                      agg_primitives=["count"],
                      trans_primitives=["month"],
                      max_depth=1,
                      features_only=True)

# save features to disk
saved_features_file = "feature_defs"
ft.save_features(feature_defs, saved_features_file)

# upload to s3
s3_connection = boto.connect_s3()
bucket = s3_connection.get_bucket('featuretools-static')
key = boto.s3.key.Key(bucket, saved_features_file)
key.set_contents_from_filename(saved_features_file)

# download from s3
downloaded_features_file = "feature_defs_downloaded"
key.get_contents_to_filename(downloaded_features_file)
feature_defs_s3 = ft.load_features(downloaded_features_file)

# test to make sure it works
feature_matrix = ft.calculate_feature_matrix(entityset=es, features=feature_defs_s3)

谢谢Max。这就是我们目前正在做的,只是试图避免这个中间步骤。这是否在路线图中?路线图是否有公共链接?这是一个很棒的库。github上有一个相关的问题,我在那里对这个问题发表了评论。请随时在GitHub上发表评论或背书。一般来说,GitHub问题是了解路线图并让我们知道您想要构建什么的最佳方式。谢谢Max。这就是我们目前正在做的,只是试图避免这一中间步骤。这是否在路线图中?路线图是否有公共链接?这是一个很棒的库。github上有一个相关的问题,我在那里对这个问题发表了评论。请随时在GitHub上发表评论或背书。一般来说,GitHub问题是了解路线图并让我们知道您想要构建什么的最佳方式。