AutoSkill Asymmetric Cost Loss Function (False Negative Cost = 0)

Defines a custom loss function in TensorFlow/Keras where predicting 1 as 0 (False Negative) has zero cost, while predicting 0 as 1 (False Positive) has a cost of 1.

install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/chinese_gpt4_8/asymmetric-cost-loss-function-false-negative-cost-0" ~/.claude/skills/ecnu-icalk-autoskill-asymmetric-cost-loss-function-false-negative-cost-0 && rm -rf "$T"
manifest: SkillBank/ConvSkill/chinese_gpt4_8/asymmetric-cost-loss-function-false-negative-cost-0/SKILL.md
source content

Asymmetric Cost Loss Function (False Negative Cost = 0)

Defines a custom loss function in TensorFlow/Keras where predicting 1 as 0 (False Negative) has zero cost, while predicting 0 as 1 (False Positive) has a cost of 1.

Prompt

Define a custom loss function in TensorFlow/Keras. The loss function must implement the logic where the cost of False Negatives (predicting 1 as 0) is 0. The cost of False Positives (predicting 0 as 1) is 1. Ensure type casting to float32 to avoid type mismatch errors.

Triggers

  • 自定义一个评估标准,把1预测成0不算错
  • 自定义loss函数
  • 把1预测成0不算错