作者都是各自领域经过审查的专家,并撰写他们有经验的主题. 我们所有的内容都经过同行评审,并由同一领域的Toptal专家验证.
伊凡Matec
验证专家 在工程
15 的经验

Ivan has over 12 years of experience developing .NET和web应用程序,包括针对医疗机构的基于web的解决方案.

分享

如果你能预测你选择的股票在下个月是涨是跌呢? Or if your favorite football team would win or lose their next match? How can you make such predictions? Perhaps machine learning can provide part of the answer. Cortana, the new digital personal assistant powered by 必应 that comes with Windows Phone 8.1 accurately predicted 15 out of 16 matches in the 2014 FIFA World Cup.

In this Azure tutorial, 我们将通过解决我们日常生活中面临的一个问题来探索Azure机器学习的特性和功能.

Azure 机器学习 tutorial

machine learning developer’s 观点, 问题可以分为两类,一类是可以用标准方法解决的问题, 和 those that cannot be solved using st和ard methods. Unfortunately, most real life problems belongs to the second group. This is where machine learning comes into play. 基本思想是使用机器在历史数据中找到有意义的模式,并用它来解决问题.

这个问题

Gas prices are probably one of the items already in most people’s budget. 持续的上涨或下跌也会影响到其他杂货和服务的价格. There are a lot of factors that can influence gas prices, from weather conditions to political decisions 和 administrative fees, 和 to totally unpredictable factors such as natural disasters or wars.

这篇Azure机器学习教程的计划是研究一些可访问的数据,并找到可以用来创建预测模型的相关性.

Azure 机器学习 Studio

Azure 机器学习 Studio 是基于web的集成开发环境(IDE)开发数据实验. 它与Azure的其他云服务紧密结合,简化了机器学习模型和服务的开发和部署.

Creating the Experiment

There are five basic steps to creating a machine learning example. 我们将通过开发我们自己的天然气价格预测模型来检验每一个步骤.

准备数据

Gathering data is one of the most important step in this process. 数据的相关性和清晰度是建立良好预测模型的基础. Azure 机器学习 Studio provides a number of sample data sets. Another great collection of datasets can be found at 存档.ics.uci.edu/ml/datasets.html.

After collecting the data, 我们需要通过简单的数据上传机制将其上传到Studio:

Azure 机器学习 Studio

Once uploaded, we can preview the data. The following picture shows part of our data that we just uploaded. Our goal here is to predict the price under the column labeled E95.

机器学习 Studio

我们的下一步是创建一个新的实验,从左边的面板上拖放模块到工作区域.

Azure Meachine Learning

数据预处理

预处理可用数据包括根据需要调整可用数据. The first module that we will use here is “Descriptive Statistics”. It computes statistical data from the available data. 除了“描述性统计”模块外,一个常用的模块是“清理缺失数据”。. 此步骤的目的是通过用其他值替换或完全删除缺失(null)值来赋予其意义.

定义特征

在我们的教程中这一步应用的另一个模块是“Filter Based Feature Selection”模块. 该模块确定与我们想要预测的结果最相关的数据集特征. 在这种情况下, as you can see in the picture below, the four most relevant features for “E95” values are “EDG BS”, “油”, “美元/ HRK”, 和“欧元/美元”.

filter based feature selection

因为“EDG BS”是另一个不能用于预测的“输出”值, 我们将从剩下的重要特征中只选择两个——石油价格, 和 currency rate under USD/HRK column.

Sample of the dataset after processing is shown below:

Azure studio数据集

Choosing 和 Applying an Algorithm

Our next step is to split the available data using the “Split” module. 数据的第一部分(在我们的例子中是80%)将用于训练模型,其余部分用于对训练后的模型进行评分.

Azure分裂模块

以下步骤是整个Azure机器学习过程中最重要的步骤. The module “Train Model” accepts two input parameters. First is the raw training data, 和 the other is the learning algorithm. Here, we will be using the “Linear Regression” algorithm. “训练模型”模块的输出是“分数模型”模块的输入参数之一. The other one is the rest of the available data. Score Model adds a new column to our dataset, Scored Labels. 当所应用的学习算法与可用数据很好地配合时,“得分标签”列下的值更接近其对应的E95值.

列车模型模块

评估模型模块给我们一个用统计值表示的训练模型的评估. If we look at “Coefficient of Determination”, 我们可以得出结论,使用该模型预测正确价格的机会约为80%.

Now, it is worth a try to use “Neural Network Regression” module. 我们需要添加新的“训练模型”和“评分模型”模块,并将输出连接到现有的“评估模型”模块.

neural network regression module

The “Neural Network Regression” module requires a bit more configuration. Since this is the most important module of the entire experiment, it is where we should focus our efforts, 调整和实验的设置和选择适当的学习算法作为一个整体.

在本例中,Evaluate模块为我们提供了两个训练模型的比较. 再一次。, 基于决定系数,我们看到神经网络提供的预测精度略低.

Azure评估模型

At this point we can save the selected trained models for future use.

Azure训练模型

当我们有一个训练好的模型时,我们可以继续创建“评分实验”. 这可以通过从头开始创建一个新的实验或使用Azure 机器学习 Studio助手来完成. Simply select the trained model 和 click on “Create Scoring Experiment”. 这里我们需要的新模块是“Web服务输入”和“Web服务输出”. 我们将添加一个“Project Columns”模块来选择输入和输出值. Input values are Oil 和 USD/HRK, ,输出为“得分模型”输出“得分标签”列下的预测值.

下图显示了经过这些调整并相应地连接“Web服务输入”和“Web服务输出”模块后的评分实验.

评分实验

Another nifty helper feature comes to play at this point. 通过“发布Web服务”,你可以在Azure的云基础设施上创建一个简单的Web服务.

发布web服务

预测新数据

Finally, we can test our prediction web service using a simple test form.

Azure测试表单

machine learning test form

结论

通过这个简单的 machine learning tutorial we have shown how to create a fully functional prediction web service. Azure机器学习工作室集成到Azure平台中可以非常 强大的工具 for creating data experiments. 除了机器学习 Studio,还有其他机器学习解决方案,例如 橙色Tiberious. Regardless of the development environment you like, 我鼓励你探索机器学习,找到你内心的数据科学家.

Hire a Toptal expert on this topic.
现在雇佣
伊凡Matec

伊凡Matec

验证专家 在工程
15 的经验

Bestovje,克罗地亚

Member since January 26, 2015

作者简介

Ivan has over 12 years of experience developing .NET和web应用程序,包括针对医疗机构的基于web的解决方案.

作者都是各自领域经过审查的专家,并撰写他们有经验的主题. 我们所有的内容都经过同行评审,并由同一领域的Toptal专家验证.

World-class articles, delivered weekly.

By entering your email, you are agreeing to our 隐私政策.

World-class articles, delivered weekly.

By entering your email, you are agreeing to our 隐私政策.

Toptal开发者

加入总冠军® 社区.