gpt4 book ai didi

azure - 在azure中注册模型后如何进行预测?

转载 作者:行者123 更新时间:2023-12-04 08:19:31 25 4
gpt4 key购买 nike

我创建了一个简单的模型,然后在azure中注册。我怎样才能做出预测?

from sklearn import svm
import joblib
import numpy as np

# customer ages
X_train = np.array([50, 17, 35, 23, 28, 40, 31, 29, 19, 62])
X_train = X_train.reshape(-1, 1)
# churn y/n
y_train = ["yes", "no", "no", "no", "yes", "yes", "yes", "no", "no", "yes"]

clf = svm.SVC(gamma=0.001, C=100.)
clf.fit(X_train, y_train)

joblib.dump(value=clf, filename="churn-model.pkl")

注册:

from azureml.core import Workspace
ws = Workspace.get(name="myworkspace", subscription_id='My_subscription_id', resource_group='ML_Lingaro')

from azureml.core.model import Model
model = Model.register(workspace=ws, model_path="churn-model.pkl", model_name="churn-model-test")

预测:

from azureml.core.model import Model
import os

model = Model(workspace=ws, name="churn-model-test")
X_test = np.array([50, 17, 35, 23, 28, 40, 31, 29, 19, 62])
model.predict(X_test) ????

错误:AttributeError:“模型”对象没有属性“预测”

最佳答案

好问题——我一开始也有同样的误解。缺少的部分是模型“注册”和模型“部署”之间存在差异。注册只是为了跟踪并方便以后在地点和时间下载。部署是您所追求的,使模型可供评分。

有一个whole section in the docs about deployment 。我的建议是先在本地部署进行测试。

关于azure - 在azure中注册模型后如何进行预测?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65556574/

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