【autosklearn 小系列】pipeline模块实现

代码包

来自:sklearn.pipeline

简述

不太像linux/编程语言中的pipeline概念,更像shell中的管道
实现的代码并不优雅
	有大量基于以下定义的过滤
`
     classifiers_ = ["adaboost", "decision_tree", "extra_trees",
                    "gradient_boosting", "k_nearest_neighbors",
                    "libsvm_svc", "random_forest", "gaussian_nb",
                    "decision_tree", "xgradient_boosting"]
    feature_learning = ["kitchen_sinks", "kernel_pca", "nystroem_sampler"]
    for c, f in product(classifiers_, feature_learning):
        if c not in classifiers:
            continue
        if f not in preprocessors:
            continue
		...
`

内容

建立多个 estimator 结合体, 包括 transforms 和 estimator
实际是一系列 steps 简单循环处理的过程
  	- steps参数传递格式:
		key:value = step名称:step对象
		- step名称:一个算法的名称
		- step对象:一个算法的实现

形式

一系列 transforms ,并以一个 estimator 结尾(estimator可以是任意类型:transformer,classifier,regresser)
    - transforms需实现方法: fit()、transform()
        - 可用 memory 参数缓存
    - estimator需实现:fit()
estimator的类型,决定了这个pipeline的类型

目的:

- 交叉验证:通过赋予不同参数,对比验证
    - 通过格式约定,来指定不同参数

遗留疑问:

并没有看到较多提升效率相关的实现,只是减少了封装和多次来回调用的消耗?
	- 有 transformer/estimator 缓存,但效率重点不在于此
估计更注重对调用者表现形式良好吧

具体代码

pipeline/pipeline.py
    - fit_transform():
        调用steps最后的 estimator
    - fit()
        --> self._fit():执行transforms
        --> self._final_estimator.fit:执行estimator

转载于:https://my.oschina.net/kakablue/blog/3045634

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值