儲存 Pipeline
你現在要再次建立 Pipeline,但這次直接在建立 Pipeline 時完成,不另外先把 StandardScaler 與 LogisticRegression 指派給變數。相反地,你會在建立 Pipeline 的同時進行初始化。
接著,你會將模型儲存起來以便後續使用。
資料以 X_train 提供,標籤為 y_train。
StandardScaler、LogisticRegression 與 Pipeline 都已經替你匯入。
本練習屬於課程
使用 Python 分析 IoT 資料
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create Pipeline
pl = Pipeline([
("scale", ____),
("logreg", ____)
])
# Fit the pipeline
____.____(____, ____)