我正在开发一个模型,该模型可以对患者是否患有肺癌进行分类。目前,它已分为右下,右上,左上和左下。我已经为每个分段使用了SVM,例如
model1 = SVM for right lower
model2 = SVM for right upper
model3 = SVM for left lower
model4 = SVM for left upper.
我已应用归一化技术,并获得了模型的准确性,准确性和召回率。还对每个模型使用K折进行评估。下一步,我需要使用堆叠集成方法将所有这些模型组合到一个分类器中由于每个模型子集的数据集不同,因此如何组合以及如何评估最终分类器。
提前感谢
也许,此解决方案可以为您提供帮助。
您可以创建4个管道,以不同的方式预处理相同的数据。之后,您可以使用Stacking。
组合它们。from sklearn.pipeline import Pipeline
from sklearn.preprocessing import FunctionTransformer
from sklearn.svm import SVC
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import StackingClassifier
# make 4 function for each SVM classifier
def preprocessing1(X):
pass
# make 4 pipelines
pipeline1 = Pipeline([
('prepr', FunctionTransformer(preprocessing1)),
('svm', SVC())
])
clf = StackingClassifier(
estimators=[
('pipe1', pipeline1),
('pipe2', pipeline2),
('pipe3', pipeline3),
('pipe4', pipeline4),
],
final_estimator=LogisticRegression(),
)
P.S。只是一个例子。您也可以尝试其他最终估算器。