BaşlayınÜcretsiz Başlayın

Visualizing predictions

The prediction DataFrame you created contains a column of explanatory variable values and a column of response variable values. That means you can plot it on the same scatter plot of response versus explanatory data values.

prediction_data is available. The code for the plot you created using sns.regplot() in Chapter 1 is shown.

Bu egzersiz

Introduction to Regression with statsmodels in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a new figure to plot multiple layers.
  • Extend the plotting code to add points for the predictions in prediction_data. Color the points red.
  • Display the layered plot.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create a new figure, fig
fig = ____

sns.regplot(x="n_convenience",
            y="price_twd_msq",
            data=taiwan_real_estate,
            ci=None)
# Add a scatter plot layer to the regplot
sns.____(____)

# Show the layered plot
plt.____()
Kodu Düzenle ve Çalıştır