make_pipeline#
- sklearn.pipeline.make_pipeline(*steps, memory=None, transform_input=None, verbose=False)[源代码]#
构建
Pipeline
来自给定的估计者。This is a shorthand for the
Pipeline
constructor; it does not require, and does not permit, naming the estimators. Instead, their names will be set to the lowercase of their types automatically.- 参数:
- *steps估计对象列表
链接在一起的scikit-learn估计器列表。
- memory具有joblib.内存接口的字符串或对象,默认=无
用于存放管道安装的变压器。最后一步永远不会被缓存,即使它是一个Transformer。默认情况下,不执行缓存。如果给出了字符串,则它是缓存目录的路径。启用缓存会在安装之前触发变形器的克隆。因此,不能直接检查提供给管道的Transformer实例。使用属性
named_steps
或steps
检查管道内的估算器。当安装耗时时,缓存变压器是有利的。- transform_input字符串列表,默认=无
这使得可以将某些输入参数转换为
fit
(除X
)通过管道的步骤转变到需要它们的步骤。要求定义为 metadata routing .例如,这可以用于通过管道传递验证集。只有在启用元数据路由时才能设置此值,可以使用
sklearn.set_config(enable_metadata_routing=True)
.Added in version 1.6.
- verbose布尔,默认=假
如果为True,则将在完成每个步骤时打印调整所花费的时间。
- 返回:
- p管道
返回scikit-learn
Pipeline
object.
参见
Pipeline
用于创建具有最终估计器的转换管道的类。
示例
>>> from sklearn.naive_bayes import GaussianNB >>> from sklearn.preprocessing import StandardScaler >>> from sklearn.pipeline import make_pipeline >>> make_pipeline(StandardScaler(), GaussianNB(priors=None)) Pipeline(steps=[('standardscaler', StandardScaler()), ('gaussiannb', GaussianNB())])