Skip to content
Back to skills

Fasttext模型评估函数定义

ASecurity

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

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationpython

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill 'fasttext模型评估函数定义' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Fasttext模型评估函数定义?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Fasttext模型评估函数定义
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-fasttext/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-fasttext)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.