基于scikit-learn的AutoML工具
项目描述
______ ______ ______
__________ /____________ /___ ________ ______ /______________
__ ___/_ //_/__ __ \_ /_ / / /_ __ `__ \_ __ \ _ \_ ___/
_(__ )_ ,< __ /_/ / / / /_/ /_ / / / / / /_/ / __/ /
/____/ /_/|_| _ .___//_/ \__,_/ /_/ /_/ /_//_.___/\___//_/
/_/
skplumber是一个机器学习(ML)包,提供两个核心功能:
- 一个自动机器学习(AutoML)系统,用于在分类或回归问题上自动采样、训练、评分和调整机器学习管道。这可以通过
skplumber.skplumber.SKPlumber
类获得。 - 一个轻量级ML框架,可以将ML原语组合成任意形状的管道(
skplumber.pipeline.Pipeline
),并使用各种评估技术(例如train/test拆分、k折交叉验证和下采样)对这些管道进行训练和拟合。此外,所有原始超参数都预先注有类型和范围信息,以便更容易地交互。此外,还提供了skplumber.tuners.ga.ga_tune
的现有超参数调整技术。
基础管道和原始构建块在很大程度上借鉴了数据驱动模型发现(D3M)核心包中存在的相同结构。
项目的API文档位于这里。
安装
pip install skplumber
用法
SKPlumber自动机器学习系统
该包的最高级API是skplumber.skplumber.SKPlumber
类。您实例化该类,然后使用它的fit
方法在给定的输入数据X
和y
(分别对应于pandas.DataFrame
和pandas.Series
)上执行对最佳机器学习(ML)管道的搜索。以下是一个使用经典的鸢尾花数据集的示例
from skplumber import SKPlumber
import pandas as pd
from sklearn.datasets import load_iris
dataset = load_iris()
X = pd.DataFrame(data=dataset["data"], columns=dataset["feature_names"])
y = pd.Series(dataset["target"])
# Ask plumber to find the best machine learning pipeline it
# can for the problem in 60 seconds.
plumber = SKPlumber(problem="classification", budget=60)
plumber.fit(X, y)
# To use the best found machine learning pipeline on unseen data:
predictions = plumber.predict(unseen_X)
管道
skplumber.pipeline.Pipeline
类是该包的一个较低级别的API,可用于构建、拟合和预测任意形状的机器学习管道。例如,我们可以创建一个基本的一级堆叠管道,其中预测器的输出被馈送到另一个预测器中,以学习方式进行集成
from skplumber import Pipeline
from skplumber.primitives import transformers, classifiers
import pandas as pd
from sklearn.datasets import load_iris
dataset = load_iris()
X = pd.DataFrame(data=dataset["data"], columns=dataset["feature_names"])
y = pd.Series(dataset["target"])
# A random imputation of missing values step and one hot encoding of
# non-numeric features step are automatically added.
pipeline = Pipeline()
# Preprocess the inputs
pipeline.add_step(transformers["StandardScalerPrimitive"])
# Save the pipeline step index of the preprocessor's outputs
stack_input = pipeline.curr_step_i
# Add three classifiers to the pipeline that all take the
# preprocessor's outputs as inputs
stack_outputs = []
for clf_name in [
"LinearDiscriminantAnalysisPrimitive",
"DecisionTreeClassifierPrimitive",
"KNeighborsClassifierPrimitive"
]:
pipeline.add_step(classifiers[clf_name], [stack_input])
stack_outputs.append(pipeline.curr_step_i)
# Add a final classifier that takes the outputs of all the previous
# three classifiers as inputs
pipeline.add_step(classifiers["RandomForestClassifierPrimitive"], stack_outputs)
# Train the pipeline
pipeline.fit(X, y)
# Have fitted pipeline make predictions
pipeline.predict(X)
包意见
- 管道的最后一步必须是产生管道最终输出的步骤。
- 所有缺失值都被插补。
- 所有类型为
object
和category
的列都被独热编码。
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源分布
skplumber-0.6.5.dev0.tar.gz (24.2 kB 查看哈希值)
构建分布
skplumber-0.6.5.dev0-py3-none-any.whl (31.2 kB 查看哈希值)
关闭
skplumber-0.6.5.dev0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | bc2678ad26eebb93fda647e0bde5d2a5e17cdca8f0a1b2bed674628c7b269f07 |
|
MD5 | 21c953ceb89466cfa04699bec36326a7 |
|
BLAKE2b-256 | fe7bbadce40f232bde8fa66897c27f4eae879773ca8d8d5d6c0242bbbb293afb |
关闭
skplumber-0.6.5.dev0-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 7b6197739cfa43f25fb8e9901e1159277dfa30a8a80e97655bcbdcf9aced02e8 |
|
MD5 | 6332563135581194d0c5b9fbc3a4c483 |
|
BLAKE2b-256 | 9d089a1881b101cf3b0c3b57d9a3f46b081db0a63166b222103b9a7d14ab212f |