शुरू करेंमुफ़्त में शुरू करें

विश्वास का आकलन करने के लिए self-consistency

नीचे दिया गया prompt ChatGPT से किसी समीक्षा के sentiment को वर्गीकृत करने के लिए कहता है। आपको self-consistency का उपयोग करके प्रत्येक श्रेणी में ChatGPT के विश्वास (confidence) का अनुमान लगाना है।

ChatGPT से संचार के लिए get_response() फंक्शन आपके लिए पहले से लोड है।

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में Explainable AI

पाठ्यक्रम देखें

अभ्यास निर्देश

  • प्रत्येक समीक्षा के लिए, responses सूची में sentiment जोड़ें।
  • प्रत्येक sentiment के लिए confidence निकालें।

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

prompt = """Classify the following review as positive or negative. 
You should reply with either "positive" or "negative", nothing else.
Review: 'The coffee was excellent, but the service left much to be desired.'"""

responses = []
for i in range(5):
    sentiment = get_response(prompt)
    # Append the response to the responses list
    ____

# Compute the confidence for each sentiment
confidence = {
    'positive': ____,
    'negative': ____
}

print(confidence)
कोड संपादित करें और चलाएँ