本文整理汇总了Python中pipeline.Pipeline.transform方法的典型用法代码示例。如果您正苦于以下问题:Python Pipeline.transform方法的具体用法?Python Pipeline.transform怎么用?Python Pipeline.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pipeline.Pipeline
的用法示例。
在下文中一共展示了Pipeline.transform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Pipeline
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import transform [as 别名]
"""
objective = Objective.MAXIMIZE
# data
train_data, train_targets = Data.train()
test_data, test_targets = Data.test()
# feature engineering
extra_data = test_data
pipe = Pipeline(Polynomial, LogisticRegressionModel, objective, logging.WARN)
pipe.fit(train_data, train_targets, extra_data)
print pipe.hyperparams
# train model
train_data = pipe.transform(train_data)
voter1 = LogisticRegressionModel(objective, logging.INFO)
models = [m(objective, logging.INFO) for m in [SVCModel, LogisticRegressionModel]]
ensemble = ClassifierEnsemble(models, voter1, objective, logging.INFO)
voter2 = LogisticRegressionModel(objective, logging.INFO)
master = ClassifierEnsemble([ensemble], voter2, objective, logging.INFO)
master.optimize(train_data, train_targets)
master.fit(train_data, train_targets, master.hyperparams)
# submission file
test_data = pipe.transform(test_data)
preds = master.predict(test_data)
print score(preds, test_targets)