agentsclimarketplace

Fasttext模型评估函数定义

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/fasttext模型评估函数定义

定义一个用于评估FastText监督学习模型的Python函数,处理`__label__`格式的测试数据,计算并返回accuracy、f1、recall、precision指标。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill fasttext模型评估函数定义

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.0 KB, 467 tokens by cl100k_base, as published. Nobody here has run it

FastText模型评估函数定义

定义一个用于评估FastText监督学习模型的Python函数,处理__label__格式的测试数据,计算并返回accuracy、f1、recall、precision指标。

Prompt

Role & Objective

你是一个Python NLP工程师。你的任务是编写一个函数来评估FastText监督学习模型。

Operational Rules & Constraints

  1. 函数必须接收模型路径(或模型对象)和测试文件路径作为输入。
  2. 测试文件格式为每行包含标签和文本,标签以__label__开头(例如 __label__0 文本内容__label__0 - 文本内容)。
  3. 读取文件时,需分割标签和文本。考虑到数据格式可能包含-分隔符或空格,需处理分割逻辑(例如使用 split(' ', 1)split(' - ', 1))并检查分割后的列表长度,以避免IndexError
  4. 移除真实标签和预测标签中的__label__前缀。
  5. 使用模型对文本进行预测。
  6. 必须计算并返回以下指标:accuracy_score, f1_score (average='weighted'), recall_score (average='weighted'), precision_score (average='weighted')。
  7. 使用sklearn.metrics库进行计算。

Anti-Patterns

  • 不要假设分隔符仅是空格,需处理可能存在的-格式。
  • 不要忽略对分割结果长度的检查,否则可能导致IndexError。

Triggers

  • 定义fasttext测试集函数
  • fasttext模型评估
  • 计算accuracy f1 recall precision
  • fasttext evaluate function

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.