Sky*_*ker 1 python preprocessor machine-learning scikit-learn
是否有一个虚拟缩放器可以插入不执行任何操作的管道中?IE
# define the SVM model using the RBF kernel
model = Pipeline(steps=[('preprocess', MinMaxScaler()),
('model', SVC(kernel='rbf',
gamma='scale',
probability=True,
class_weight='balanced',
cache_size=1000,
tol=1e-10,
shrinking=True,
decision_function_shape='ovr',
break_ties=False,
C=3.0))])
params = [{'preprocess': [DummyDoNothingScaler(), MaxAbsScaler(), MinMaxScaler(), StandardScaler()],
'model__gamma': ['scale', 'auto'],
'model__C': [1.0, 1.01, 1.015,3.0]
}]
Run Code Online (Sandbox Code Playgroud)
有没有DummyDoNothingScaler?
小智 6
我认为 Skywalker 提供了一个非常干净的解决方案,但如果您想创建一些对象来测试,您可以尝试以下操作:
from sklearn.preprocessing import FunctionTransformer
DummyScaler = FunctionTransformer(lambda x: x)
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你!