gpt4 book ai didi

python - AWS Sagemaker AttributeError : can't set attribute error

转载 作者:行者123 更新时间:2023-12-05 00:55:02 26 4
gpt4 key购买 nike

我是 python 编程的新手。遵循 AWS 学习路径:

https://aws.amazon.com/getting-started/hands-on/build-train-deploy-machine-learning-model-sagemaker/?trk=el_a134p000003yWILAA2&trkCampaign=DS_SageMaker_Tutorial&sc_channel=el&sc_campaign=Data_Scientist_Hands-on_Tutorial&sc_outcome=Product_Marketing&sc_geo=mult

执行以下 block 时出现错误(在 conda_python3 中):

test_data_array = test_data.drop(['y_no', 'y_yes'], axis=1).values #load the data into an array
xgb_predictor.content_type = 'text/csv' # set the data type for an inference
xgb_predictor.serializer = csv_serializer # set the serializer type
predictions = xgb_predictor.predict(test_data_array).decode('utf-8') # predict!
predictions_array = np.fromstring(predictions[1:], sep=',') # and turn the prediction into an
array
print(predictions_array.shape)

AttributeError Traceback (most recent call last) in 1 test_data_array = test_data.drop(['y_no', 'y_yes'], axis=1).values #load the data into an array----> 2 xgb_predictor.content_type = 'text/csv' # set the data type for an inference3 xgb_predictor.serializer = csv_serializer # set the serializer type4 predictions = xgb_predictor.predict(test_data_array).decode('utf-8') # predict!5 predictions_array = np.fromstring(predictions[1:], sep=',') # and turn the prediction into an array

AttributeError: can't set attribute

我查看了几个先前的问题,但在创建数据类型时找不到与此错误相关的太多信息。

提前感谢您的帮助。

最佳答案

如果您只是删除它,那么预测将起作用。因此,建议删除此代码行。xgb_predictor.content_type = '文本/csv'

关于python - AWS Sagemaker AttributeError : can't set attribute error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65465114/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com