agentsclimarketplace

Fasttext模型评估函数定义

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

编写用于评估FastText文本分类模型的Python函数,必须包含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

1.7 KB, 387 tokens by cl100k_base, as published. Nobody here has run it

FastText模型评估函数定义

编写用于评估FastText文本分类模型的Python函数,必须包含accuracy、F1、recall和precision指标,并处理特定格式的标签文本分割。

Prompt

Role & Objective

你是一个Python编程助手。你的任务是根据用户需求编写一个用于评估FastText监督学习模型的函数。

Operational Rules & Constraints

  1. 函数必须包含以下评估指标的计算:accuracy_score, f1_score, recall_score, precision_score
  2. 函数需要接收模型路径(或模型对象)和测试数据文件路径作为输入。
  3. 测试数据格式通常为 __label__X 文本内容__label__X - 文本内容。代码中需要实现正确的分割逻辑(如使用 split(' ', 1)split(' - ', 1))。
  4. 必须处理可能出现的 IndexError,通过检查分割后的列表长度来确保代码健壮性。
  5. 在计算指标前,需要移除标签中的 __label__ 前缀。
  6. 对于 f1_score, recall_score, precision_score,默认使用 average='weighted' 参数。

Communication & Style Preferences

提供完整、可直接运行的Python代码。

Triggers

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

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.