MulaiMulai sekarang secara gratis

Saving & Loading Models

Often times you may find yourself going back to a previous model to see what assumptions or settings were used when diagnosing where your prediction errors were coming from. Perhaps there was something wrong with the data? Maybe you need to incorporate a new feature to capture an unusual event that occurred?

In this example, you will practice saving and loading a model.

Latihan ini adalah bagian dari kursus

Feature Engineering with PySpark

Lihat Kursus

Petunjuk latihan

  • Import RandomForestRegressionModel from pyspark.ml.regression.
  • Using the model in memory called model call the save() method on it and name the model rfr_no_listprice.
  • Reload the saved model file rfr_no_listprice by calling load() on RandomForestRegressionModel and storing it into loaded_model.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

from ____ import ____

# Save model
model.____(____)

# Load model
loaded_model = ____.____(____)
Edit dan Jalankan Kode