def sample_pipelines(pca_kernels=None, svr_kernels=None):
"""
Pipelines that can't be fit in a reasonable amount of time on the whole
dataset
"""
# Model instances
model_steps = []
if pca_kernels is None:
pca_kernels = ['poly', 'rbf', 'sigmoid', 'cosine']
for pca_kernel in pca_kernels:
model_steps.append([
KernelPCA(n_components=2, kernel=pca_kernel),
LinearRegression(),
])
if svr_kernels is None:
svr_kernels = ['poly', 'rbf', 'sigmoid']
for svr_kernel in svr_kernels:
model_steps.append(SVR(kernel=svr_kernel, verbose=True, cache_size=1000))
# Pipelines
pipelines = []
for m in model_steps:
# Steps
common_steps = [
StandardScaler(),
]
model_steps = m if isinstance(m, list) else [m]
steps = common_steps + model_steps
pipelines.append(make_pipeline(*steps))
return pipelines
评论列表
文章目录