sql 机器学习_使用sql进行机器学习比您想象的要容易

sql 机器学习

If you’ve been studying data science, it’s likely you know how to perform machine learning tasks in languages like Python, R, and Julia. But what can you do when speed is the key, the hardware is limited, or the company you work for treats SQL as the only option for predictive analytics? In-database machine learning is the answer.

如果您一直在研究数据科学,那么您很可能知道如何使用PythonRJulia这样的语言执行机器学习任务。 但是,当速度是关键,硬件有限或您工作的公司将SQL视为预测分析的唯一选择时,您该怎么办? 数据库内机器学习就是答案。

We’ll use Oracle Cloud for this article. It’s free, so please register and create an instance of the OLTP database (Version 19c, has 0.2TB of storage). Once done, download the cloud wallet and establish a connection through SQL Developer — or any other tool.

本文将使用Oracle Cloud 。 它是免费的,因此请注册并创建OLTP数据库实例(版本19c,具有0.2TB的存储空间)。 完成后,下载云钱包并通过SQL Developer或任何其他工具建立连接。

This will take you 10 minutes at least but is a fairly straightforward thing to do, so I won’t waste time on it.

这至少要花10分钟,但这是一件很简单的事情,所以我不会在上面浪费时间。

We’ll use Oracle Machine Learning (OML) to train a classification model on the well-known Iris dataset. I’ve chosen it because it doesn’t require any preparation — we only need to create the table and insert the data.

我们将使用Oracle Machine Learning(OML)在著名的Iris数据集上训练分类模型。 我选择它是因为它不需要任何准备-我们只需要创建表并插入数据即可。

Let’s do that next.

让我们接下来做。

资料准备 (Data preparation)

As mentioned, we need to create a table for holding the Iris dataset, and then we need to load data to it. OML requires one column to be used as row ID (sequence), so let’s keep that in mind:

如前所述,我们需要创建一个表来保存虹膜数据集,然后将数据加载到该表中。 OML需要将一列用作行ID(序列),因此请记住这一点:

CREATE SEQUENCE seq_iris;
CREATE TABLE iris_data(
iris_id NUMBER DEFAULT seq_iris.NEXTVAL,
sepal_length NUMBER,
sepal_width NUMBER,
petal_length NUMBER,
petal_width NUMBER,
species VARCHAR2(16)
);

Awesome! Now we can download the data and load it:

太棒了! 现在我们可以下载数据并加载它:

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值