私は、AWS Machine LearningのバッチプロセスをPythonプロジェクトから使用しようとしています。私はboto3を使用しています。私は応答でこの失敗メッセージを受け取ります。python呼び出しboto3.client.create_data_source_from_s3
は、スキーマを解析しようエラーが発生しました:\ 'START_ARRAY \ nは[ソースのトークンのうち、ブールの インスタンスをデシリアライズできません: [email protected]。行:1、列:2](参照を通じて チェーン: com.amazon.eml.dp.recordset.SchemaPojo [ "dataFileContainsHeader"])
\私は作品を使用しています.csvファイル。私はこれがコンソールプロセスを通して働いたのでこれを知っています。
ここは私のコードです。それが処理されるファイルへのURLを保持しているDjangoのモデル(INPUT_FILE)内の関数である:
def create_data_source_from_s3(self):
attributes = []
attribute = { "fieldName": "Var1", "fieldType": "CATEGORICAL" }
attributes.append(attribute)
attribute = { "fieldName": "Var2", "fieldType": "CATEGORICAL" }
attributes.append(attribute)
attribute = { "fieldName": "Var3", "fieldType": "NUMERIC" }
attributes.append(attribute)
attribute = { "fieldName": "Var4", "fieldType": "CATEGORICAL" }
attributes.append(attribute)
attribute = { "fieldName": "Var5", "fieldType": "CATEGORICAL" }
attributes.append(attribute)
attribute = { "fieldName": "Var6", "fieldType": "CATEGORICAL" }
attributes.append(attribute)
dataSchema = {}
dataSchema['version'] = '1.0'
dataSchema['dataFormat'] = 'CSV'
dataSchema['attributes'] = attributes
dataSchema["targetFieldName"] = "Var6"
dataSchema["dataFileContainsHeader"] = True,
json_data = json.dumps(dataSchema)
client = boto3.client('machinelearning', region_name=settings.region, aws_access_key_id=settings.aws_access_key_id, aws_secret_access_key=settings.aws_secret_access_key)
#create a datasource
return client.create_data_source_from_s3(
DataSourceId=self.input_file.name,
DataSourceName=self.input_file.name,
DataSpec={
'DataLocationS3': 's3://' + settings.AWS_S3_BUCKET_NAME + '/' + self.input_file.name,
'DataSchema': json_data,
},
ComputeStatistics=True
)
私が間違ってやっている任意のアイデア?