Back to skills
SKILL.md
Fasttext模型评估函数定义
ASecurity编写用于评估FastText文本分类模型的Python函数,必须包含accuracy、F1、recall和precision指标,并处理特定格式的标签文本分割。
- 2 stars
- 0 votes
- 0 copies
- 0 views
- Added September 27, 2026
Security analysis
100/100npx -y skills add David-Li0406/meta-skill-evloving --skill 'fasttext模型评估函数定义' --agent claude-codeAre you the author of Fasttext模型评估函数定义?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/david-li0406-fasttext)---
id: "18d05507-a479-484c-a6e2-32a24a4161f7"
name: "FastText模型评估函数定义"
description: "编写用于评估FastText文本分类模型的Python函数,必须包含accuracy、F1、recall和precision指标,并处理特定格式的标签文本分割。"
version: "0.1.0"
tags:
- "fasttext"
- "模型评估"
- "python"
- "sklearn"
- "文本分类"
triggers:
- "定义fasttext评估函数"
- "fasttext测试集函数accuracy f1"
- "计算fasttext模型precision recall"
---
# 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
Attribution
Comments
Loading comments…