[英]How to set learner type for Python Model in Azure Machine Learning Designer?
I am testing Azure Machine Learning Designer by having a custom Python Model (a simple kNN classification).我正在通过自定义 Python Model(一个简单的 kNN 分类)来测试 Azure 机器学习设计器。 I would like to tune the value of 'k' and get the best performing model but "Tune Model Hyperparameters" module gives following error when giving output from my "Create Python Model" as input.
I would like to tune the value of 'k' and get the best performing model but "Tune Model Hyperparameters" module gives following error when giving output from my "Create Python Model" as input.
ModuleExceptionMessage:LearnerTypesNotCompatible: Got incompatible learner type: "None". Expected learner types are: "(<TaskType.BinaryClassification: 1>, <TaskType.MultiClassification: 2>, <TaskType.Regression: 3>)".
How I can set the learner type of my own Python model?如何设置我自己的 Python model 的学习者类型? Is it even possible?
甚至可能吗? Should I just code the parameter tuning myself with "Execute Python Script"-module?
我是否应该使用“执行 Python 脚本”模块自己编写参数调整?
My "Create Python model"-module script:我的“创建 Python 模型”-模块脚本:
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
class AzureMLModel:
def __init__(self, k = 3):
self.model = KNeighborsClassifier(n_neighbors = k)
self.feature_column_names = list()
def train(self, df_train, df_label):
self.feature_column_names = df_train.columns.tolist()
self.model.fit(df_train, df_label)
def predict(self, df):
return pd.DataFrame({'Scored Labels': self.model.predict(df[self.feature_column_names])})
Tune Model Hyperparameters
module does not support using the Create Python Model
module as an input model. Tune Model Hyperparameters
模块不支持使用Create Python Model
模块作为输入 Z4DB904F35E68305ZAF4。
My recommendation, would be to explore using the azureml-sdk
's HyperDrive
to tune hyper-parameters.我的建议是探索使用
azureml-sdk
的HyperDrive
来调整超参数。 Here's a link that gives an introduction, there's a Jupyter notebook at the end as well. 这是一个提供介绍的链接,最后还有一个 Jupyter 笔记本。
Thanks for your question.谢谢你的问题。 Tune Model Hyperparameters does not support Create Python Model.
调整 Model 超参数不支持创建 Python Model。 Please use Execute Python Script to tune the parameters.
请使用执行 Python 脚本来调整参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.