本文整理汇总了Python中pipeline.Pipeline.add_col方法的典型用法代码示例。如果您正苦于以下问题:Python Pipeline.add_col方法的具体用法?Python Pipeline.add_col怎么用?Python Pipeline.add_col使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pipeline.Pipeline
的用法示例。
在下文中一共展示了Pipeline.add_col方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Pipeline
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import add_col [as 别名]
import build
import pandas as pd
from pipeline import Pipeline
PATH = 'cs-training.csv'
TEST = explore.snake_columns(pd.read_csv('cs-test.csv', index_col=0))
my_pipeline = Pipeline(PATH, TEST)
# explore
print('exploring')
my_pipeline.explore()
# add features
print('adding features')
#my_pipeline.add_col('monthly_income')
my_pipeline.add_col('age', transform_type='squared')
my_pipeline.create_binary('number_of_dependents')
my_pipeline.split('serious_dlqin2yrs')
# process
print('processing')
my_pipeline.impute('number_of_dependents', method='mode')
my_pipeline.impute('monthly_income', method='median')
my_pipeline.export_train_tocsv()
# build models
#['KNN','RF','LR','ET','AB','GB','NB','DT']
models=['KNN','DT','NB','LR']
#get X and y
print('building models')
示例2: Pipeline
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import add_col [as 别名]
import build
import pandas as pd
from pipeline import Pipeline
PATH = 'cs-training.csv'
TEST = explore.snake_columns(pd.read_csv('cs-test.csv', index_col=0))
my_pipeline = Pipeline(PATH, TEST)
# explore
print('exploring')
my_pipeline.explore()
# process
print('processing')
my_pipeline.impute('number_of_dependents', method='mode')
my_pipeline.impute('monthly_income', method='mean')
# add features
print('adding features')
my_pipeline.add_col('monthly_income')
my_pipeline.add_col('age', transform_type='squared')
my_pipeline.create_binary('number_of_dependents')
my_pipeline.split('serious_dlqin2yrs')
my_pipeline.export_train_tocsv()
# build models
print('building models')
my_pipeline.build('logistic')
my_pipeline.build('knn')
print(my_pipeline.models)