我对机器学习完全是个新手,我一直在研究非监督式学习技术。
图片显示我的样本数据(清理后)截图: 样本数据
我建立了这两个管道来清理数据:
num_attribs = list(housing_num)
cat_attribs = ["ocean_proximity"]
print(type(num_attribs))
num_pipeline = Pipeline([
('selector', DataFrameSelector(num_attribs)),
('imputer', Imputer(strategy="median")),
('attribs_adder', CombinedAttributesAdder()),
('std_scaler', StandardScaler()),
])
cat_pipeline = Pipeline([
('selector', DataFrameSelector(cat_attribs)),
('label_binarizer', LabelBinarizer())
])
然后我将这两个管道合并,其代码如下所示:
from sklearn.pipeline import FeatureUnion
full_pipeline = FeatureUnion(transformer_list=[
("num_pipeline", num_pipeline),
("cat_pipeline", cat_pipeline),
])
现在我尝试在 百科上做 fit _ change,但它显示了错误。
转换代码:
housing_prepared = full_pipeline.fit_transform(housing)
housing_prepared
错误信息:
Fit _ change ()有2个位置参数,但是给出了3个