首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >蓝色机器学习笔记本上的错误: DataFrame的真值不明确

蓝色机器学习笔记本上的错误: DataFrame的真值不明确
EN

Stack Overflow用户
提问于 2021-10-19 08:44:33
回答 1查看 133关注 0票数 0

在使用他们的笔记本时,我在Azure上部署了一个机器学习模型,但我遇到了一个错误。为了实现Power集成,我将跟踪这个教程

当执行此代码时:

代码语言:javascript
复制
import sklearn

from azureml.core import Workspace
from azureml.core import Model
from azureml.core.resource_configuration import ResourceConfiguration

ws = Workspace.from_config()
model = Model.register(workspace=ws,
                       model_name='POC',                # Name of the registered model in your workspace.
                       model_path='./final_model.pkl',  # Local file to upload and register as a model.
                       model_framework=Model.Framework.SCIKITLEARN,  # Framework used to create the model.
                       model_framework_version=sklearn.__version__,  # Version of scikit-learn used to create the model.
                       sample_input_dataset=X,
                       sample_output_dataset=y,
                       resource_configuration=ResourceConfiguration(cpu=2, memory_in_gb=4),
                       description='RandomForestClassifier.',
                       tags={'area': 'finance', 'type': 'classification'})

print('Name:', model.name)
print('Version:', model.version)

我遇到了以下错误:

代码语言:javascript
复制
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Menu Uitvoer
Registering model POC
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-65-d8fe09fe9514> in <module>
     15                        resource_configuration=ResourceConfiguration(cpu=2, memory_in_gb=4),
     16                        description='RandomForestClassifier.',
---> 17                        tags={'area': 'finance', 'type': 'classification'})
     18 
     19 print('Name:', model.name)

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/core/model.py in register(workspace, model_path, model_name, tags, properties, description, datasets, model_framework, model_framework_version, child_paths, sample_input_dataset, sample_output_dataset, resource_configuration)
    593                                            sample_input_dataset=sample_input_dataset,
    594                                            sample_output_dataset=sample_output_dataset,
--> 595                                            resource_configuration=resource_configuration)
    596 
    597         return model

我的sample_input_dataset for X是我的Pandas DataFrame,My的sample_output_dataset是Pandas系列,我也尝试使用Numpy数组。

EN

回答 1

Stack Overflow用户

发布于 2022-04-04 17:41:46

解决方案是在TabularDataset中转换X和y。

这样做的唯一方法是在AML工作区中注册数据并下载它。也许还有更聪明的方法。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69627691

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档