神经网络回归模块Neural Network Regression module

使用神经网络算法创建回归模型 Creates a regression model using a neural network algorithm

类别:机器学习/初始化模型/回归Category: Machine Learning / Initialize Model / Regression

模块概述Module overview

本文介绍 Azure 机器学习设计器(预览版)中的一个模块。This article describes a module in Azure Machine Learning designer (preview).

使用此模块可以通过可自定义的神经网络算法创建回归模型。Use this module to create a regression model using a customizable neural network algorithm.

尽管神经网络广泛用于深度学习和建模的复杂问题(如图像识别),但它们可以轻松地适应回归问题。Although neural networks are widely known for use in deep learning and modeling complex problems such as image recognition, they are easily adapted to regression problems. 如果有任何统计模型类使用自适应权重,并且这些类可以逼近自身输入的非线性函数,则可以将其称为神经网络。Any class of statistical models can be termed a neural network if they use adaptive weights and can approximate non-linear functions of their inputs. 因此神经网络回归适用于更传统的回归模型无法适应解决方案的问题。Thus neural network regression is suited to problems where a more traditional regression model cannot fit a solution.

神经网络回归是一种监督式学习方法,因此需要一个“带标记的数据集”(其中包含一个标签列) 。Neural network regression is a supervised learning method, and therefore requires a tagged dataset, which includes a label column. 由于回归模型预测数值,因此标签列必须是数值数据类型。Because a regression model predicts a numerical value, the label column must be a numerical data type.

通过提供模型和带标记的数据集作为训练模型的输入,可对模型进行训练。You can train the model by providing the model and the tagged dataset as an input to Train Model. 然后,可使用训练后的模型来预测新输入示例的值。The trained model can then be used to predict values for the new input examples.

配置神经网络回归Configure Neural Network Regression

可以广泛地自定义神经网络。Neural networks can be extensively customized. 本节介绍如何使用以下两种方式创建模型:This section describes how to create a model using two methods:

  • 使用默认体系结构创建神经网络模型Create a neural network model using the default architecture

    如果接受默认的神经网络体系结构,请使用“属性”窗格设置控制神经网络行为的参数,如隐藏层中的节点数、学习比率和规范化 。If you accept the default neural network architecture, use the Properties pane to set parameters that control the behavior of the neural network, such as the number of nodes in the hidden layer, learning rate, and normalization.

    如果不熟悉神经网络,请先从本节开始。Start here if you are new to neural networks. 模块支持许多自定义和模型优化,无需深入了解神经网络。The module supports many customizations, as well as model tuning, without deep knowledge of neural networks.

  • 定义神经网络的自定义体系结构Define a custom architecture for a neural network

    如果想要添加额外的隐藏层,或完全自定义网络体系结构、连接和激活功能,请使用此选项。Use this option if you want to add extra hidden layers, or fully customize the network architecture, its connections, and activation functions.

    如果你对神经网络已有一定程度的了解,最好选择此选项。This option is best if you are already somewhat familiar with neural networks. 使用 Net# 语言定义网络体系结构。You use the Net# language to define the network architecture.

使用默认体系结构创建神经网络模型Create a neural network model using the default architecture

  1. 在设计器中将“神经网络回归”模块添加到管道 。Add the Neural Network Regression module to your pipeline in the designer. 可以在“机器学习”、“初始化”下的“回归”类别中找到此模块 。You can find this module under Machine Learning, Initialize, in the Regression category.

  2. 通过设置“创建训练程序模式”选项,指示如何训练模型 。Indicate how you want the model to be trained, by setting the Create trainer mode option.

    • 单个参数:如果已知如何配置模型,请选择此选项。Single Parameter: Choose this option if you already know how you want to configure the model.

    • 参数范围:如果无法确定最佳参数并想要运行参数扫描,请选择此选项。Parameter Range: Select this option if you are not sure of the best parameters, and want to run a parameter sweep. 选择要循环访问的值范围,优化模型超参数模块将循环访问所提供的设置的所有可能组合,以确定产生最佳结果的超参数。Select a range of values to iterate over, and the Tune Model Hyperparameters iterates over all possible combinations of the settings you provided to determine the hyperparameters that produce the optimal results.

  3. 在“隐藏层规范”中,选择“完全连接事例” 。In Hidden layer specification, select Fully connected case. 此选项使用默认的神经网络体系结构创建模型,这种网络体系结构对于神经网络回归模型具有以下属性:This option creates a model using the default neural network architecture, which for a neural network regression model, has these attributes:

    • 网络只有一个隐藏层。The network has exactly one hidden layer.
    • 输出层完全连接到隐藏层,并且隐藏层完全连接到输入层。The output layer is fully connected to the hidden layer and the hidden layer is fully connected to the input layer.
    • 隐藏层中的节点数可由用户设置(默认值为 100)。The number of nodes in the hidden layer can be set by the user (default value is 100).

    由于输入层中的节点数取决于训练数据中的功能数,因此在回归模型中,输出层只能有一个节点。Because the number of nodes in the input layer is determined by the number of features in the training data, in a regression model there can be only one node in the output layer.

  4. 对于“隐藏节点数”,请键入隐藏节点的数目。For Number of hidden nodes, type the number of hidden nodes. 默认为一个隐藏层,其中包含 100 个节点。The default is one hidden layer with 100 nodes. (如果使用 Net# 定义自定义体系结构,则不可用此选项。)(This option is not available if you define a custom architecture using Net#.)

  5. 对于“学习比率”,请键入一个值,用于定义更正之前每次迭代要执行的步骤。For Learning rate, type a value that defines the step taken at each iteration, before correction. 学习比率的值越大,模型的汇聚速度就越快,但它可以超过本地最小值。A larger value for learning rate can cause the model to converge faster, but it can overshoot local minima.

  6. 对于“学习迭代数”,请指定算法处理训练事例的最大次数。For Number of learning iterations, specify the maximum number of times the algorithm processes the training cases.

  7. 对于“动力”,请键入一个要在学习过程中应用的值,作为之前迭代中的节点的权重。For The momentum, type a value to apply during learning as a weight on nodes from previous iterations.

  8. 选择“无序播放示例”选项,以更改迭代之间的事例顺序。Select the option, Shuffle examples, to change the order of cases between iterations. 如果取消选择此选项,则每次运行管道时,都会以完全相同的顺序处理事例。If you deselect this option, cases are processed in exactly the same order each time you run the pipeline.

  9. 对于“随机数种子”,可以选择键入一个值,将其用作种子。For Random number seed, you can optionally type a value to use as the seed. 指定种子值对于确保同一管道的运行可重复性非常重要。Specifying a seed value is useful when you want to ensure repeatability across runs of the same pipeline.

  10. 连接训练数据集,然后训练模型:Connect a training dataset and train the model:

    • 如果将“创建训练程序模式”设置为“单个参数”,请连接带标记的数据集和训练模型模块 。If you set Create trainer mode to Single Parameter, connect a tagged dataset and the Train Model module.

    • 如果将“创建训练程序模式”设置为“参数范围”,则连接标记的数据集并使用优化模型超参数模块来训练模型 。If you set Create trainer mode to Parameter Range, connect a tagged dataset and train the model by using Tune Model Hyperparameters.

    备注

    如果将参数范围传递给训练模型模块,则它只使用单个参数列表中的默认值。If you pass a parameter range to Train Model, it uses only the default value in the single parameter list.

    如果将一组参数值传递给优化模型超参数模块,则当它期望每个参数有一系列设置时,它会忽略这些值,并为学习器使用默认值。If you pass a single set of parameter values to the Tune Model Hyperparameters module, when it expects a range of settings for each parameter, it ignores the values, and uses the default values for the learner.

    如果选择“参数范围”选项并为任何参数输入单个值,则整个扫描过程中都会使用你指定的单个值,即使其他参数的一系列值发生了更改。If you select the Parameter Range option and enter a single value for any parameter, that single value you specified is used throughout the sweep, even if other parameters change across a range of values.

  11. 提交管道。Submit the pipeline.

结果Results

在训练完成后:After training is complete:

  • 若要保存已训练模型的快照,请选择“训练模型”模块右侧面板中的“输出”选项卡。To save a snapshot of the trained model, select the Outputs tab in the right panel of the Train model module. 选择“注册数据集”图标将模型保存为可重用模块。Select the Register dataset icon to save the model as a reusable module.

后续步骤Next steps

请参阅 Azure 机器学习的可用模块集See the set of modules available to Azure Machine Learning.