使用管道符组合使用命令

Surely you have heard of pipelines or ETL (Extract Transform Load), or seen some method in a library, or even heard of any tool to create pipelines. However, you aren’t using it yet. So, let me introduce you to the fantastic world of pipelines.

当然,您听说过管道或ETL(提取转换负载),或者在库中看到了一些方法,甚至听说过任何用于创建管道的工具。 但是,您尚未使用它。 因此,让我向您介绍梦幻般的管道世界。

Before understanding how to use them, we have to understand what it is.

在了解如何使用它们之前,我们必须了解它的含义。

A pipeline is a way to wrap and automatize a process, which means that the process will always be executed in the same way, with the same functions and parameters and the outcome will always be in the predetermined standard.

管道是包装和自动化过程的一种方式,这意味着该过程将始终以相同的方式执行,并具有相同的功能和参数,并且结果将始终符合预定的标准。

So, as you may guess, the goal is to apply pipelines in every development stage to try to guarantee that the designed process never ends up different from the one idealized.

因此,您可能会猜到,目标是在每个开发阶段都应用管道,以确保设计过程永远不会与理想化过程不同。

KapwingKapwin g制成

There are in particular two uses of pipelines in data science, either in production or during the modelling/exploration, that have a huge importance. Furthermore, it makes our life much easier.

在数据科学中,无论是在生产中还是在建模/探索期间,管道都有两种特别重要的用途。 此外,它使我们的生活更加轻松。

The first one is the data ETL. During production, the ramifications are way greater, and consequently, the level of detail spent in it, however, it can be summed up as:

第一个是数据ETL。 在生产过程中,后果会更加严重,因此花费在其中的详细程度也可以总结为:

E (Extract) — How am I going to collect the data? If I am going to collect them from one or several sites, one or more databases, or even a simple pandas csv. We can think of this stage as the data reading phase.

E(摘录)—我将如何收集数据? 如果我要从一个或多个站点,一个或多个数据库甚至一个简单的熊猫csv收集它们。 我们可以将此阶段视为数据读取阶段。

T (Transform) — What do I need to do for the data to become usable? This can be thought of as the conclusion of the exploratory data analysis, which means after we know what to do with the data (remove features, transform categorical variables into binary data, cleaning strings, etc.), we compile it all in a function that guarantees that cleaning will always be done in the same way.

T(转换)—要使数据变得可用我需要做什么? 这可以被认为是探索性数据分析的结论,这意味着在我们知道如何处理数据(删除功能,将分类变量转换为二进制数据,清理字符串等)之后,我们将其全部编译为一个函数这样可以确保始终以相同的方式进行清洁。

L (Load) — This is simply to save the data in the desired format (csv, data base, etc.) somewhere, either cloud or locally, to use anytime, anywhere.

L(负载)—这只是将数据以所需的格式(csv,数据库等)保存在云端或本地的任何地方,以便随时随地使用。

The simplicity of the creation of this process is such that it can be done only by grabbing that exploratory data analysis notebook, put that pandas read_csv inside a funcion; write the several functions to prepare the data and compile them in one; and finally create a function saving the result of the previous one.

创建此过程非常简单,只需抓住该探索性数据分析记录本,然后将熊猫read_csv放入函数中即可完成 。 编写几个函数来准备数据并将它们合而为一; 最后创建一个保存上一个结果的函数。

Having this, we can create the main function in a python file and with one line of code executes the created ETL, without risking any changes. Not to mention the advantages of changing/updating everything in a single place.

有了这一点,我们可以在python文件中创建main函数,并用一行代码执行创建的ETL,而无需冒险进行任何更改。 更不用说在单个位置更改/更新所有内容的优势。

And the second, and likely the most advantageous pipeline, helps solve one of the most common problems in machine learning: the parametrization.

第二,可能是最有利的管道,有助于解决机器学习中最常见的问题之一:参数化。

How many times have we faced these questions: which model to choose? Should I use normalization or standardization?

我们已经面对这些问题多少次了:选择哪种模型? 我应该使用标准化还是标准化?

“Screenshot captured by author”
“作者捕获的屏幕截图”

Libraries such as scikit-learn offer us the pipeline method where we can put several models, with their respective parameters’ variance, add pre-processing such as normalization, standardization or even a custom process, and even add cross-validation at the end. Afterwards, all possibilities will be tested, and the results returned, or even only the best result, like in the following code:

诸如scikit-learn之类的库为我们提供了流水线方法,我们可以放置几个具有各自参数差异的模型,添加诸如标准化,标准化甚至是自定义过程之类的预处理,甚至最后添加交叉验证。 之后,将测试所有可能性,并返回结果,甚至仅返回最佳结果,如以下代码所示:

def build_model(X,y):                           pipeline = Pipeline([        ('vect',CountVectorizer(tokenizer=tokenize)),        ('tfidf', TfidfTransformer()),        ('clf', MultiOutputClassifier(estimator=RandomForestClassifier()))                           ])# specify parameters for grid search                           parameters = {     # 'vect__ngram_range': ((1, 1), (1, 2)),      # 'vect__max_df': (0.5, 0.75, 1.0),                                    # 'vect__max_features': (None, 5000, 10000),    # 'tfidf__use_idf': (True, False),    # 'clf__estimator__n_estimators': [50,100,150,200],    # 'clf__estimator__max_depth': [20,50,100,200],    # 'clf__estimator__random_state': [42]                                                   } 

# create grid search object                          cv = GridSearchCV(pipeline, param_grid=parameters, verbose=1)                                                   return cv

At this stage, the sky is the limit! There are no parameters limits inside the pipeline. However, depending on the database and the chosen parameters it can take an eternity to finish. Even so, it is a very good tool to funnel the research.

在这个阶段,天空是极限! 管道内部没有参数限制。 但是,根据数据库和所选的参数,可能要花很长时间才能完成。 即使这样,它还是进行研究的很好工具。

We can add a function to read the data that comes out of the data ETL, and another to save the created model and we have model ETL, wrapping up this stage.

我们可以添加一个函数来读取来自数据ETL的数据,另一个函数可以保存创建的模型,并且我们拥有模型ETL,从而结束了这一阶段。

In spite of everything that we talked about, the greatest advantages of creating pipelines are the replicability and maintenance of your code that improve exponentially.

尽管我们讨论了所有问题,但是创建管道的最大优势是代码的可复制性和维护性得到了指数级的提高。

So, what are you waiting for to start creating pipelines?

那么,您还等什么来开始创建管道?

An example of these can be found in this project.

在此项目中可以找到这些示例。

翻译自: https://towardsdatascience.com/how-to-use-the-magic-of-pipelines-6e98d7e5c9b7

使用管道符组合使用命令


http://www.taodudu.cc/news/show-997581.html

相关文章:

  • 2020年十大币预测_2020年十大商业智能工具
  • 为什么我们需要使用Pandas新字符串Dtype代替文本数据对象
  • nlp构建_使用NLP构建自杀性推文分类器
  • 时间序列分析 lstm_LSTM —时间序列分析
  • 泰晤士报下载_《泰晤士报》和《星期日泰晤士报》新闻编辑室中具有指标的冒险活动-第1部分:问题
  • 异常检测机器学习_使用机器学习检测异常
  • 特征工程tf-idf_特征工程-保留和删除的内容
  • 自我价值感缺失的表现_不同类型的缺失价值观和应对方法
  • 学习sql注入:猜测数据库_面向数据科学家SQL:学习简单方法
  • python自动化数据报告_如何:使用Python将实时数据自动化到您的网站
  • 学习深度学习需要哪些知识_您想了解的有关深度学习的所有知识
  • 置信区间估计 预测区间估计_估计,预测和预测
  • 地图 c-suite_C-Suite的模型
  • sap中泰国有预扣税设置吗_泰国餐厅密度细分:带有K-means聚类的python
  • 傅里叶变换 直观_A / B测试的直观模拟
  • 鸽子 迷信_人工智能如何帮助我战胜鸽子
  • scikit keras_Scikit学习,TensorFlow,PyTorch,Keras…但是天秤座呢?
  • 数据结构两个月学完_这是我作为数据科学家两年来所学到的
  • 迈向数据科学的第一步:在Python中支持向量回归
  • 使用Python和MetaTrader在5分钟内开始构建您的交易策略
  • ipywidgets_未来价值和Ipywidgets
  • 用folium模块画地理图_使用Folium表示您的地理空间数据
  • python创建类统计属性_轻松创建统计数据的Python包
  • knn分类 knn_关于KNN的快速小课程
  • 机器学习集群_机器学习中的多合一集群技术在无监督学习中应该了解
  • 政府公开数据可视化_公开演讲如何帮助您设计更好的数据可视化
  • 消费者行为分析_消费者行为分析-是否点击广告?
  • 魅族mx5游戏模式小熊猫_您不知道的5大熊猫技巧
  • 数据科学中的数据可视化
  • 多重线性回归 多元线性回归_了解多元线性回归

使用管道符组合使用命令_如何使用管道的魔力相关推荐

  1. php禁止组合热键,cad组合快捷键命令有哪些

    cad组合快捷键命令有:1.[Ctrl+B]为栅格捕捉模式控制:2.[Ctrl+P]为打印:3.[Ctrl+C]将选择的对象复制到剪切板上:4.[Ctrl+F]为控制是否实现对象自动捕捉. cad组合 ...

  2. unix 存储空间不足 无法处理此命令_大数据分析命令行使用教程

    在与数据科学紧密联系的计算机科学领域,像开发人员一样控制计算机是一项非常宝贵的资产.Unix命令行界面(CLI;您还将看到它称为终端或bash,shell等),它使我们能够执行更多操作. 因此,我们推 ...

  3. 不用公钥批量部署机器执行命令_模版

    批量部署机器执行命令_小模版 案例: 脚本目的:两台以上机器(ip:172.16.1.187和172.16.1.188)去拷贝主控制机器IP:172.16.1.199上目录/liang/下的ceshi ...

  4. Polyworks脚本开发学习笔记(八)-组合运用命令批量改名

    Polyworks脚本开发学习笔记(八)-组合运用命令批量改名 需求解析 以下是使用包边比较点创建的一组包边点(即Gap点)和曲面点-包边点(即Flush点),这种命名方式不太常规,改为Gap和Flu ...

  5. 昊鼎王五:Windows运行中的所有命令_Windows快捷命令_运行中的所有命令

    昊鼎王五:Windows运行中的所有命令_Windows快捷命令_"运行"中的所有命令 winver 检查Windows版本 wmimgmt.msc 打开Windows管理体系结构 ...

  6. RHEL6入门系列之十一,内/外部命令、重定向、管道

    前面一口气介绍了18个命令,可能大家都已经有些晕了.学习Linux就是这样,它不像Windows那样的傻瓜式操作,要想学好Linux是必须要下苦功的.所以,Linux本身就不是一个面向普通用户的桌面操 ...

  7. linux怎么打出管道命令这个符号,linux 管道命令 竖线 ‘ | ’

    管道符号,是unix功能强大的一个地方,符号是一条竖线:"|", 用法: command 1 | command 2 他的功能是把第一个命令command 1执行的结果作为comm ...

  8. Linux 终端命令(重定向,gedit,more,管道,cat,grep,find,tar)一

    1. 输出重定向命令:> 和 >> Linux允许将命令执行结果重定向到一个文件,本应显示在终端上的内容保存到指定文件中. 1.1 >和>> 与 ls 配合使用 1 ...

  9. linux替换bash,bash脚本_输入输出和管道、替换

    以cat为例,功能是从文件读数据,送到stdout. # cat tmp back-loop.sh cgiselect 要是没有文件作为命令的参数,那么就要从stdin输入,实际上就是将界面输入的字符 ...

最新文章

  1. 基于QProbe创建基本Android图像处理框架
  2. 【专家观点】张亚勤、张宏江:人工智能的未来是什么?
  3. SpriteBuilder实际操作中如何确定合适Breaking force的值
  4. tensorflow--variable_scope
  5. angr学习笔记(6)(内存地址单元符号化)
  6. 心事一件件的了掉,希望一切都能恢复到正常
  7. python to sql_python的to_sql那点儿事
  8. 科大讯飞 ai算法挑战赛_为井字游戏挑战构建AI算法
  9. 计组之总线:3、总线操作和定时(同步定时、异步定时、版同步通信、分离式通信)
  10. 看别人情侣空间显示服务器繁忙什么意思,调查13000位80后年轻人,他们的感情状态究竟如何?...
  11. 修改jceks.key.serialFilter解决KMS重启后Can‘t recover key for testkey from keystore file
  12. python后台执行代码
  13. ADVHAT: REAL-WORLD ADVERSARIAL ATTACK ON ARCFACE FACE ID SYSTEM 笔记
  14. PhotoShop简单案例(1)——利用时间轴功能制作简单动画
  15. 分析 : BSOD案例 2013-0821
  16. 无效镜像问题image has dependent child images
  17. 顺序表的时间复杂度分析
  18. 面试题(二十五)设计模式
  19. PS系列 -- 颜色替换
  20. 盘古开源解析:数据防泄漏对于数据安全的重要性

热门文章

  1. 远程桌面最新漏洞CVE-2019-0708 POC利用复现
  2. web前端【第十一篇】jQuery属性相关操作
  3. 【BZOJ3932】[CQOI2015]任务查询系统 主席树
  4. 转: 关于 ssl的建立链接的过程
  5. 【优雅代码】深入浅出 妙用Javascript中apply、call、bind
  6. 三种地理参考信息模型:WMS,WFS,WCS(转)
  7. 我也发软件开发团队的思考(侧重点是人员)
  8. WordPress Option API(数据库储存 API)
  9. python3 自动打包部署war包
  10. 如何基于 Notadd 构建 API (Laravel 写 API)