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

Interpreting regressors locally

You are provided with a KNN regressor model that predicts health insurance costs based on features such as age, sex, BMI, number of children, and smoking status. Your task is to assess how each feature affects the prediction for a given sample.

The KNN model and the necessary packages are pre-loaded for you.

Bu egzersiz

Explainable AI in Python

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

Egzersiz talimatları

  • Create a LIME explainer for the KNN regressor model.
  • Generate an explanation for the model's prediction on the provided sample_data_point.
  • Display the influence of each feature on the prediction.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

from lime.lime_tabular import LimeTabularExplainer

sample_data_point = X.iloc[2, :]

# Create the explainer
explainer = ____

# Generate the explanation
exp = ____

# Display the explanation
exp.____
plt.show()
Kodu Düzenle ve Çalıştır