暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

[未完待续] 流式机器学习(online machine learning) - pipelineDB with plR and plPython

digoal 2017-11-07
441

作者

digoal

日期

2017-11-07

标签

PostgreSQL , 在线机器学习 , 流式机器学习 , pipelinedb , plr , plpython , madlib


背景

pipelinedb 是一款基于PostgreSQL的SQL接口的流式数据库,数据处理吞吐量大,同时能使用PostgreSQL的内置强大功能。

对用户来说,可以省掉很多开发成本,使用pipelinedb以及plpython或plr语言,实现流式的机器学习,流式的数据处理。

pipelinedb作为流式数据处理平台,plpython和plr作为处理逻辑代码,写在pipelinedb数据库中。

例子:

1、定义数据流格式

create stream s1 (id int, content jsonb);

2、定义数据处理逻辑代码

```
create or replace function ml_func1(jsonb) returns text as $$
-- python代码
$$ language plpythonu strict;

create or replace function ml_func1(jsonb) returns text as $$
-- R代码
$$ language plr strict;
```

3、定义流式计算视图

createa continue view cv1 as select id, ml_func1(content) from s1;

4、通过SQL查询cv1得到流式计算的结果

select * from cv1 where ....;

DEMO

小结

参考

https://www.postgresql.org/docs/10/static/plpython.html

https://github.com/postgres-plr/plr

《流计算风云再起 - PostgreSQL携PipelineDB力挺IoT》

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论