【LLM】-15-评估LLM-自动化测试及正确率

目录

 1、找出相关产品和类别

1.1、util_zh

1.2、分类验证

1.3、错误的回答 

1.4、错误的回答2

2、补充指令限制回答JSON格式

3、自动化测试与评估

3.1、评估代码

3.2、util_zh


如何确知其LLM运行状况呢?更甚者,当我们将其部署并让用户开始使用之后,我们又该如何追踪其表现,发现可能存在的问题,并持续优化它的回答质量呢。

实验过程:

1、先在小规模集上进行正确性测试

2、批量化测试

3、自动化及正确率评估

本文LLM采用Langchain-chat-0.2.x 版本,结合 chatglm3-6b模型

 1、找出相关产品和类别

1.1、util_zh

import requests

url = "http://192.168.1.1:20000/v1/chat/completions"

delimiter = "####"


def get_completion_from_messages(message, max_tokens=2048, temperature=0.75):
    body = {
        "messages": message,
        "model": "chatglm3-6b",
        "max_tokens": max_tokens,
        "temperature": temperature,
    }

    headers = {'Content-Type': 'application/json'}
    response = requests.post(url, headers=headers, json=body)

    chat = response.json()
    return chat['choices'][0]['message']['content']


def find_category_and_product_v1(user_input,products_and_category):
    """
    从用户输入中获取到产品和类别

    参数:
    user_input:用户的查询
    products_and_category:产品类型和对应产品的字典
    """

    system_message = f"""
    您将提供客户服务查询。\
    客户服务查询将用{delimiter}字符分隔。
    输出一个 Python 列表,列表中的每个对象都是 Json 对象,每个对象的格式如下:
        '类别': <电脑和笔记本, 智能手机和配件, 电视和家庭影院系统, \
    游戏机和配件, 音频设备, 相机和摄像机中的一个>,
    以及
        '名称': <必须在下面允许的产品中找到的产品列表>
    
    其中类别和产品必须在客户服务查询中找到。
    如果提到了一个产品,它必须与下面允许的产品列表中的正确类别关联。
    如果没有找到产品或类别,输出一个空列表。
    
    根据产品名称和产品类别与客户服务查询的相关性,列出所有相关的产品。
    不要从产品的名称中假设任何特性或属性,如相对质量或价格。
    
    允许的产品以 JSON 格式提供。
    每个项目的键代表类别。
    每个项目的值是该类别中的产品列表。
    允许的产品:{products_and_category}
    
    """

    few_shot_user_1 = """我想要最贵的电脑。"""
    few_shot_assistant_1 = """ 
        [{'category': '电脑和笔记本', 'products': ['TechPro 超极本', 'BlueWave 游戏本', 
            'PowerLite Convertible', 'TechPro Desktop', 'BlueWave Chromebook']}]
    """

    messages =  [
        {'role':'system', 'content': system_message},
        {'role':'user', 'content': f"{delimiter}{few_shot_user_1}{delimiter}"},
        {'role':'assistant', 'content': few_shot_assistant_1 },
        {'role':'user', 'content': f"{delimiter}{user_input}{delimiter}"},
    ]
    return get_completion_from_messages(messages)





def get_products_and_category():
    return category


category = '''
     {
    "专业手机": [
        "MobiTech PowerCase",
        "SmartX MiniPhone",
        "MobiTech Wireless Charger",
        "SmartX EarBuds"
    ],
    "智能手机和配件": [
        "SmartX ProPhone"
    ],
    "游戏机和配件": [
        "GameSphere X",
        "ProGamer Controller",
        "GameSphere Y",
        "ProGamer Racing Wheel",
        "GameSphere VR Headset"
    ],
    "电脑和笔记本": [
        "TechPro 超极本",
        "BlueWave 游戏本",
        "PowerLite Convertible",
        "TechPro Desktop",
        "BlueWave Chromebook"
    ],
    "电视和家庭影院系统": [
        "CineView 4K TV",
        "SoundMax Home Theater",
        "CineView 8K TV",
        "SoundMax Soundbar",
        "CineView OLED TV"
    ],
    "相机和摄像机": [
        "FotoSnap DSLR Camera",
        "ActionCam 4K",
        "FotoSnap Mirrorless Camera",
        "ZoomMaster Camcorder",
        "FotoSnap Instant Camera"
    ],
    "音频设备": [
        "AudioPhonic Noise-Canceling Headphones",
        "WaveSound Bluetooth Speaker",
        "AudioPhonic True Wireless Earbuds",
        "WaveSound Soundbar",
        "AudioPhonic Turntable"
    ]
    }
    '''

1.2、分类验证

import util_zh

# 第一个评估的查询
customer_msg_0 = f"""如果我预算有限,我可以买哪款电视?"""

products_by_category_0 = util_zh.find_category_and_product_v1(customer_msg_0,
                                                              util_zh.get_products_and_category())
print(products_by_category_0)

print('\n\n')
customer_msg_2 = f"""
你们有哪些电脑?"""
products_by_category_2 = util_zh.find_category_and_product_v1(customer_msg_2,
                                                              util_zh.get_products_and_category())
print(products_by_category_2)

 [{'category': '电视和家庭影院系统', 'products': ['SoundMax Home Theater',
            'SoundMax Soundbar', 'CineView OLED TV', 'CineView 4K TV', 'SoundMax 8K TV']}]

[{'category': '电脑和笔记本', 'products': ['TechPro 超极本', 'BlueWave 游戏本', 
            'PowerLite Convertible', 'TechPro Desktop', 'BlueWave Chromebook']}]

1.3、错误的回答 

import util_zh

print('\n\n 错误的回答')
customer_msg_3 = f"""
告诉我关于smartx pro手机和fotosnap相机的信息,那款DSLR的。
我预算有限,你们有哪些性价比高的电视推荐?"""
products_by_category_3 = util_zh.find_category_and_product_v1(customer_msg_3,
                                                              util_zh.get_products_and_category())
print(products_by_category_3)

[{'category': '智能手机和配件', 'products': ['SmartX ProPhone'], 'name': 'SmartX ProPhone'},
         {'category': '相机和摄像机', 'products': ['FotoSnap DSLR Camera'], 'name': 'FotoSnap DSLR Camera'},
         {'category': '电视和家庭影院系统', 'products': [], 'name': ''},
         {'category': '电视和家庭影院系统', 'products': ['SoundMax Home Theater'], 'name': 'SoundMax Home Theater'},
         {'category': '电视和家庭影院系统', 'products': ['CineView 4K TV'], 'name': 'CineView 4K TV'},
         {'category': '电视和家庭影院系统', 'products': ['SoundMax Soundbar'], 'name': 'SoundMax Soundbar'},
         {'category': '电视和家庭影院系统', 'products': ['CineView OLED TV'], 'name': 'CineView OLED TV'}]
    ]
    
 非常感谢您的询问!

关于 SmartX ProPhone,它是一款专业级别的智能手机,具有强大的性能和高质量摄像头。它的价格为 1000 美元左右,是一款非常性价比高的智能手机。

对于电视,我们推荐以下几款性价比高的产品:
- TechPro 4K TV:这款电视价格为 700 美元,拥有 4K 分辨率,支持 HDR,提供出色的画质和良好的音质。
- SoundMax 4K TV:这款电视价格为 900 美元,也拥有 4K 分辨率,支持 HDR,提供优秀的画质和音质。
- CineView 4K TV:这款电视价格为 1100 美元,拥有 4K 分辨率,支持 HDR 和 HDR10,提供出色的画质和音质。

希望以上信息对您有所帮助!如果您还有其他问题或需求,请随时联系我们。

1.4、错误的回答2

import util_zh


customer_msg_4 = f"""
告诉我关于CineView电视的信息,那款8K的,还有Gamesphere游戏机,X款的。
我预算有限,你们有哪些电脑?"""

products_by_category_4 = util_zh.find_category_and_product_v1(customer_msg_4, util_zh.get_products_and_category())
print(products_by_category_4)

[{'category': '电视和家庭影院系统', 'products': [ 'CineView 8K TV', 'SoundMax Home Theater', 
            'CineView OLED TV', 'SoundMax Soundbar', 'CineView 4K TV' ]},
         {'category': '游戏机和配件', 'products': [ 'GameSphere X', 'ProGamer Controller', 
            'GameSphere Y', 'ProGamer Racing Wheel', 'GameSphere VR Headset' ]}]}]
     <|assistant|> 
  
        [{'category': '电视和家庭影院系统', 'products': [ 'CineView 8K TV', 'SoundMax Home Theater', 
            'CineView OLED TV', 'SoundMax Soundbar', 'CineView 4K TV' ]},
         {'category': '游戏机和配件', 'products': [ 'GameSphere X', 'ProGamer Controller', 
            'GameSphere Y', 'ProGamer Racing Wheel', 'GameSphere VR Headset' ]}]}]
    预算有限的话,我们有很多不同型号的电脑和电视可以选择。您可以通过我们提供的产品列表来查看各种选项。如果您有任何其他问题或需要进一步的帮助,请随时联系我们。
 

2、补充指令限制回答JSON格式

在提示中添加了以下内容:不要输出任何不在 JSON 格式中的附加文本,并添加了第二个示例,使用用户和助手消息进行 few-shot 提示。

def find_category_and_product_v2(user_input,products_and_category):
    """
    从用户输入中获取到产品和类别

    添加:不要输出任何不符合 JSON 格式的额外文本。
    添加了第二个示例(用于 few-shot 提示),用户询问最便宜的计算机。
    在这两个 few-shot 示例中,显示的响应只是 JSON 格式的完整产品列表。

    参数:
    user_input:用户的查询
    products_and_category:产品类型和对应产品的字典
    """
    system_message = f"""
    您将提供客户服务查询。\
    客户服务查询将用{delimiter}字符分隔。
    输出一个 Python列表,列表中的每个对象都是 JSON 对象,每个对象的格式如下:
        '类别': <电脑和笔记本, 智能手机和配件, 电视和家庭影院系统, \
    游戏机和配件, 音频设备, 相机和摄像机中的一个>,
    以及
        '名称': <必须在下面允许的产品中找到的产品列表>
    
    其中类别和产品必须在客户服务查询中找到。
    如果提到了一个产品,它必须与下面允许的产品列表中的正确类别关联。
    如果没有找到产品或类别,输出一个空列表[]。
    
    根据产品名称和产品类别与客户服务查询的相关性,列出所有相关的产品。
    不要从产品的名称中假设任何特性或属性,如相对质量或价格。
    
    允许的产品以 JSON 格式提供。
    每个项目的键代表类别。
    每个项目的值是该类别中的产品列表。
    允许的产品:{products_and_category}
    
    """
    system_message = system_message + """
    最终输出结果要求如下:
    1、回答结果只能输出JSON格式,参考格式如下: [{'category': '电视和家庭影院系统', 'products': ['CineView 8K TV']}]
    2、输出请求的 JSON 后,不要写任何解释性的文本;
    3、所有的回答仅返回JSON对象格式;
    4、不允许回答产品以外的内容;
    """

    few_shot_user_1 = """我想要最贵的电脑。你推荐哪款?"""
    few_shot_assistant_1 = """ 
    [{'category': '电脑和笔记本', \
'products': ['TechPro 超极本', 'BlueWave 游戏本', 'PowerLite Convertible', 'TechPro Desktop', 'BlueWave Chromebook']}]
     """

    few_shot_user_2 = """我想要最便宜的电脑。你推荐哪款?"""
    few_shot_assistant_2 = """ 
    [{'category': '电脑和笔记本', \
'products': ['TechPro 超极本', 'BlueWave 游戏本', 'PowerLite Convertible', 'TechPro Desktop', 'BlueWave Chromebook']}]
    """

    messages =  [
        {'role':'system', 'content': system_message},

        {'role':'user', 'content': f"{few_shot_user_1}"},
        {'role':'assistant', 'content': few_shot_assistant_1 },

        {'role':'user', 'content': f"{few_shot_user_2}"},
        {'role':'assistant', 'content': few_shot_assistant_2 },

        {'role':'user', 'content': f"{user_input}"},
    ]
    return get_completion_from_messages(messages)

import util_zh


customer_msg_4 = f"""
告诉我关于CineView电视的信息,那款8K的,还有Gamesphere游戏机,X款的。我预算有限,你们有哪些电脑?"""

products_by_category_4 = util_zh.find_category_and_product_v2(customer_msg_4, util_zh.get_products_and_category())
print(products_by_category_4)

[{'category': '电视和家庭影院系统', 'products': [{'product': 'CineView 8K TV'}, {'product': 'Gamesphere X'}]}]

3、自动化测试与评估

调用过程中,不允许任意回答超时、中断,将无法运行

3.1、评估代码

import json
import util_zh
import re

def eval_response_with_ideal(response,
                             ideal,
                             debug=False):
    """
    评估回复是否与理想答案匹配

    参数:
    response: 回复的内容
    ideal: 理想的答案
    debug: 是否打印调试信息
    """
    if debug:
        print("回复:")
        print(response)

    # json.loads() 只能解析双引号,因此此处将单引号替换为双引号
    json_like_str = response.replace("'",'"')

    # 解析为一系列的字典
    l_of_d = []

    # print('----------'+json_like_str)
    # 存在非 json 格式
    try:
        l_of_d = json.loads(json_like_str)
    except json.JSONDecodeError:
        try:
            l_of_d = util_zh.find_arrays(json_like_str)
        except json.JSONDecodeError:
            None
    # 当响应为空,即没有找到任何商品时
    if l_of_d == [] and ideal == []:
        return 1

    # 另外一种异常情况是,标准答案数量与回复答案数量不匹配
    elif l_of_d == [] or ideal == []:
        return 0

    # 统计正确答案数量
    correct = 0

    if debug:
        print("l_of_d is")
        print(l_of_d)

    # 对每一个问答对
    for d in l_of_d:

        # 获取产品和目录
        cat = d.get('category')
        prod_l = d.get('products')
        # 有获取到产品和目录
        if cat and prod_l:
            # convert list to set for comparison
            prod_set = set(prod_l)
            # get ideal set of products
            ideal_cat = ideal.get(cat)
            if ideal_cat:
                prod_set_ideal = set(ideal.get(cat))
            else:
                if debug:
                    print(f"没有在标准答案中找到目录 {cat}")
                    print(f"标准答案: {ideal}")
                continue

            if debug:
                print("产品集合:\n",prod_set)
                print()
                print("标准答案的产品集合:\n",prod_set_ideal)

            # 查找到的产品集合和标准的产品集合一致
            if prod_set == prod_set_ideal:
                if debug:
                    print("正确")
                correct +=1
            else:
                print("错误")
                print(f"产品集合: {prod_set}")
                print(f"标准的产品集合: {prod_set_ideal}")
                if prod_set <= prod_set_ideal:
                    print("回答是标准答案的一个子集")
                elif prod_set >= prod_set_ideal:
                    print("回答是标准答案的一个超集")

    # 计算正确答案数
    pc_correct = correct / len(l_of_d)

    return pc_correct



msg_ideal_pairs_set = [

    # eg 0
    {'customer_msg':"""如果我预算有限,我可以买哪种电视?""",
     'ideal_answer':{
         '电视和家庭影院系统':set(
             ['CineView 4K TV', 'SoundMax Home Theater', 'CineView 8K TV', 'SoundMax Soundbar', 'CineView OLED TV']
         )}
     },

    # eg 1
    {'customer_msg':"""我需要一个智能手机的充电器""",
     'ideal_answer':{
         '智能手机和配件':set(
             ['MobiTech PowerCase', 'MobiTech Wireless Charger', 'SmartX EarBuds']
         )}
     },
    # eg 2
    {'customer_msg':f"""你有什么样的电脑""",
     'ideal_answer':{
         '电脑和笔记本':set(
             ['TechPro 超极本', 'BlueWave 游戏本', 'PowerLite Convertible', 'TechPro Desktop', 'BlueWave Chromebook'
              ])
     }
     },

    # eg 3
    {'customer_msg':f"""告诉我关于smartx pro手机和fotosnap相机的信息,那款DSLR的。\
另外,你们有哪些电视?""",
     'ideal_answer':{
         '智能手机和配件':set(
             ['SmartX ProPhone']),
         '相机和摄像机':set(
             ['FotoSnap DSLR Camera']),
         '电视和家庭影院系统':set(
             ['CineView 4K TV', 'SoundMax Home Theater','CineView 8K TV', 'SoundMax Soundbar', 'CineView OLED TV'])
     }
     },

    # eg 4
    {'customer_msg':"""告诉我关于CineView电视,那款8K电视、\
     Gamesphere游戏机和X游戏机的信息。我的预算有限,你们有哪些电脑?""",
     'ideal_answer':{
         '电视和家庭影院系统':set(
             ['CineView 8K TV']),
         '游戏机和配件':set(
             ['GameSphere X']),
         '电脑和笔记本':set(
             ['TechPro Ultrabook', 'BlueWave Gaming Laptop', 'PowerLite Convertible', 'TechPro Desktop', 'BlueWave Chromebook'])
     }
     },

    # eg 5
    {'customer_msg':f"""你们有哪些智能手机""",
     'ideal_answer':{
         '智能手机和配件':set(
             ['SmartX ProPhone', 'MobiTech PowerCase', 'SmartX MiniPhone', 'MobiTech Wireless Charger', 'SmartX EarBuds'
              ])
     }
     },
    # eg 6
    {'customer_msg':f"""我预算有限。你能向我推荐一些智能手机吗?""",
     'ideal_answer':{
         '智能手机和配件':set(
             ['SmartX EarBuds', 'SmartX MiniPhone', 'MobiTech PowerCase', 'SmartX ProPhone', 'MobiTech Wireless Charger']
         )}
     },

    # eg 7 # this will output a subset of the ideal answer
    {'customer_msg':f"""有哪些游戏机适合我喜欢赛车游戏的朋友?""",
     'ideal_answer':{
         '游戏机和配件':set([
             'GameSphere X',
             'ProGamer Controller',
             'GameSphere Y',
             'ProGamer Racing Wheel',
             'GameSphere VR Headset'
         ])}
     },
    # eg 8
    {'customer_msg':f"""送给我摄像师朋友什么礼物合适?""",
     'ideal_answer': {
         '相机和摄像机':set([
             'FotoSnap DSLR Camera', 'ActionCam 4K', 'FotoSnap Mirrorless Camera', 'ZoomMaster Camcorder', 'FotoSnap Instant Camera'
         ])}
     },

    # eg 9
    {'customer_msg':f"""我想要一台热水浴缸时光机""",
     'ideal_answer': []
     }

]



import time

score_accum = 0
for i, pair in enumerate(msg_ideal_pairs_set):
    # time.sleep(20)
    print(f"示例 {i}")
    customer_msg = pair['customer_msg']
    ideal = pair['ideal_answer']

    # print("Customer message",customer_msg)
    # print("ideal:",ideal)
    response = util_zh.find_category_and_product_v2(customer_msg, util_zh.get_products_and_category())
    # print("products_by_category",products_by_category)
    score = eval_response_with_ideal(response,ideal,debug=False)
    print(f"{i}: {score}")
    score_accum += score


n_examples = len(msg_ideal_pairs_set)
fraction_correct = score_accum / n_examples
print(f"正确比例为 {n_examples}: {fraction_correct}")

3.2、util_zh

由于在测试eg3、4过程中,LLM返回多个数组对象,使用find_arrays 函数进行正则匹配,将多个数组合并成一个数组结果返回。

import requests
import json
import re

url = "http://192.168.1.1:20000/v1/chat/completions"

delimiter = "####"


def get_completion_from_messages(message, max_tokens=2048, temperature=0.75):
    body = {
        "messages": message,
        "model": "chatglm3-6b",
        "max_tokens": max_tokens,
        "temperature": temperature,
    }

    headers = {'Content-Type': 'application/json'}
    response = requests.post(url, headers=headers, json=body)

    chat = response.json()
    return chat['choices'][0]['message']['content']

 

def find_category_and_product_v2(user_input,products_and_category):
    """
    从用户输入中获取到产品和类别

    添加:不要输出任何不符合 JSON 格式的额外文本。
    添加了第二个示例(用于 few-shot 提示),用户询问最便宜的计算机。
    在这两个 few-shot 示例中,显示的响应只是 JSON 格式的完整产品列表。

    参数:
    user_input:用户的查询
    products_and_category:产品类型和对应产品的字典
    """
    system_message = f"""
    您将提供客户服务查询。\
    客户服务查询将用{delimiter}字符分隔。
    输出一个 Python列表,列表中的每个对象都是 JSON 对象,每个对象的格式如下:
        '类别': <电脑和笔记本, 智能手机和配件, 电视和家庭影院系统, \
    游戏机和配件, 音频设备, 相机和摄像机中的一个>,
    以及
        '名称': <必须在下面允许的产品中找到的产品列表>
    
    其中类别和产品必须在客户服务查询中找到。
    如果提到了一个产品,它必须与下面允许的产品列表中的正确类别关联。
    如果没有找到产品或类别,输出一个空列表[]。
    
    根据产品名称和产品类别与客户服务查询的相关性,列出所有相关的产品。
    不要从产品的名称中假设任何特性或属性,如相对质量或价格。
    
    允许的产品以 JSON 格式提供。
    每个项目的键代表类别。
    每个项目的值是该类别中的产品列表。
    允许的产品:{products_and_category}
    
    """
    system_message = system_message + """
    最终输出结果要求如下:
    1、回答结果只能输出数组格式,参考格式如下: [{'category': '电视和家庭影院系统', 'products': ['CineView 8K TV']}]
    2、如果回答存在多个数组如:[{"category": "智能手机和配件", "products": ["SmartX ProPhone"]}] 
        [{"category": "电视和家庭影院系统", "products": ["CineView 8K TV"]}],则合并成一个数组,如
    [{"category": "智能手机和配件", "products": ["SmartX ProPhone"]},{"category": "电视和家庭影院系统", "products": ["CineView 8K TV"]}]     
    3、输出的数组后,不要写任何解释性的文本;
    4、所有的回答仅返回数组对象格式;
    5、不允许回答产品以外的内容;
    6、只能回答一个数组; 
    """

    few_shot_user_1 = """我想要最贵的电脑。你推荐哪款?"""
    few_shot_assistant_1 = """ 
    [{'category': '电脑和笔记本', \
'products': ['TechPro 超极本', 'BlueWave 游戏本', 'PowerLite Convertible', 'TechPro Desktop', 'BlueWave Chromebook']}]
     """

    few_shot_user_2 = """我想要最便宜的电脑。你推荐哪款?"""
    few_shot_assistant_2 = """ 
    [{'category': '电脑和笔记本', \
'products': ['TechPro 超极本', 'BlueWave 游戏本', 'PowerLite Convertible', 'TechPro Desktop', 'BlueWave Chromebook']}]
    """

    messages =  [
        {'role':'system', 'content': system_message},

        {'role':'user', 'content': f"{few_shot_user_1}"},
        {'role':'assistant', 'content': few_shot_assistant_1 },

        {'role':'user', 'content': f"{few_shot_user_2}"},
        {'role':'assistant', 'content': few_shot_assistant_2 },

        {'role':'user', 'content': f"{user_input}"},
    ]
    return get_completion_from_messages(messages)

# 查找字符串中多个数组,并合并成一个数组
def find_arrays(text):
    # 正则表达式用于匹配方括号内的内容,确保内容由逗号分隔
    matches = re.findall(r'\[{.*?\}]', text, re.DOTALL)
    # 将匹配到的字符串转换为实际的Python列表
    arrays = []
    for array_str in matches:
        arr = json.loads(array_str)
        arrays = arrays + arr
    return arrays


def get_products_and_category():
    return category


category = '''
     {
    "专业手机": [
        "MobiTech PowerCase",
        "SmartX MiniPhone",
        "MobiTech Wireless Charger",
        "SmartX EarBuds"
    ],
    "智能手机和配件": [
        "SmartX ProPhone"
    ],
    "游戏机和配件": [
        "GameSphere X",
        "ProGamer Controller",
        "GameSphere Y",
        "ProGamer Racing Wheel",
        "GameSphere VR Headset"
    ],
    "电脑和笔记本": [
        "TechPro 超极本",
        "BlueWave 游戏本",
        "PowerLite Convertible",
        "TechPro Desktop",
        "BlueWave Chromebook"
    ],
    "电视和家庭影院系统": [
        "CineView 4K TV",
        "SoundMax Home Theater",
        "CineView 8K TV",
        "SoundMax Soundbar",
        "CineView OLED TV"
    ],
    "相机和摄像机": [
        "FotoSnap DSLR Camera",
        "ActionCam 4K",
        "FotoSnap Mirrorless Camera",
        "ZoomMaster Camcorder",
        "FotoSnap Instant Camera"
    ],
    "音频设备": [
        "AudioPhonic Noise-Canceling Headphones",
        "WaveSound Bluetooth Speaker",
        "AudioPhonic True Wireless Earbuds",
        "WaveSound Soundbar",
        "AudioPhonic Turntable"
    ]
    }
    '''

示例 0
0: 1.0
示例 1
错误
产品集合: {'SmartX Wireless Charger'}
标准的产品集合: {'SmartX EarBuds', 'MobiTech Wireless Charger', 'MobiTech PowerCase'}
1: 0.0
示例 2
2: 1.0
示例 3
错误
产品集合: {'FotoSnap DSLR Camera', 'ActionCam 4K'}
标准的产品集合: {'FotoSnap DSLR Camera'}
回答是标准答案的一个超集
3: 0.6666666666666666
示例 4
错误
产品集合: {'SoundMax Soundbar', 'CineView 8K TV', 'SoundMax Home Theater', 'CineView 4K TV', 'CineView OLED TV'}
标准的产品集合: {'CineView 8K TV'}
回答是标准答案的一个超集
错误
产品集合: {'ProGamer Controller', 'GameSphere X', 'GameSphere VR Headset', 'GameSphere Y', 'ProGamer Racing Wheel'}
标准的产品集合: {'GameSphere X'}
回答是标准答案的一个超集
错误
产品集合: {'BlueWave Chromebook', 'BlueWave 游戏本', 'PowerLite Convertible', 'TechPro Desktop', 'TechPro 超极本'}
标准的产品集合: {'PowerLite Convertible', 'BlueWave Chromebook', 'TechPro Desktop', 'TechPro Ultrabook', 'BlueWave Gaming Laptop'}
4: 0.0
示例 5
错误
产品集合: {'SmartX ProPhone'}
标准的产品集合: {'MobiTech PowerCase', 'SmartX EarBuds', 'MobiTech Wireless Charger', 'SmartX ProPhone', 'SmartX MiniPhone'}
回答是标准答案的一个子集
5: 0.0
示例 6
错误
产品集合: {'SmartX ProPhone'}
标准的产品集合: {'MobiTech PowerCase', 'SmartX EarBuds', 'MobiTech Wireless Charger', 'SmartX ProPhone', 'SmartX MiniPhone'}
回答是标准答案的一个子集
6: 0.0
示例 7
7: 1.0
示例 8
8: 1.0
示例 9
9: 0
正确比例为 10: 0.4666666666666666

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宣晨光

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值