시작하기무료로 시작하기

감성 분석 예측 설명하기

제품 리뷰가 긍정 또는 부정 감정을 표현하는지 분류하는 model이 제공되어 있어요. LIME을 사용해 주어진 text_instance에서 어떤 단어들이 모델의 예측에 가장 큰 영향을 미치는지 찾아보세요.

입력 텍스트를 처리하는 model_predict 함수는 미리 로드되어 있어요.

이 연습은 강의의 일부입니다

Python으로 배우는 Explainable AI

강의 보기

연습 안내

  • explainer라는 이름의 LIME 텍스트 설명기를 생성하세요.
  • 주어진 text_instance에 대한 모델 예측을 상위 5개 특성으로 설명을 생성하세요.
  • 모델의 판단에 영향을 준 상위 단어들과 그 가중치를 표시하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

from lime.lime_text import LimeTextExplainer

text_instance = "Amazing battery life and the camera quality is perfect! I highly recommend this smartphone."

# Create a LIME text explainer
explainer = ____()

# Generate the explanation
exp = explainer.____(____, model_predict, num_features=____)

# Display the explanation
exp.____()
plt.show()
코드 편집 및 실행