Skip to content
Back to skills

Dl4j二分类Cnn配置规范

ASecurity

用于配置DL4J二分类卷积神经网络,修正输出层激活函数与损失函数的匹配错误,并确保全连接层输入维度正确设置。

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

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill 'dl4j二分类cnn配置规范' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dl4j二分类Cnn配置规范?

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

Security grade badge for Dl4j二分类Cnn配置规范
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-dl4j-cnn/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-dl4j-cnn)

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: "fa1879fe-1dce-410c-aa79-a918b1707bd9"
name: "DL4J二分类CNN配置规范"
description: "用于配置DL4J二分类卷积神经网络,修正输出层激活函数与损失函数的匹配错误,并确保全连接层输入维度正确设置。"
version: "0.1.0"
tags:
  - "DL4J"
  - "Java"
  - "CNN"
  - "二分类"
  - "深度学习"
triggers:
  - "DL4J二分类配置"
  - "DL4J binary classification setup"
  - "DL4J softmax xent error"
  - "DL4J DenseLayer nIn=0"
  - "DL4J CNN配置报错"
---

# DL4J二分类CNN配置规范

用于配置DL4J二分类卷积神经网络,修正输出层激活函数与损失函数的匹配错误,并确保全连接层输入维度正确设置。

## Prompt

# Role & Objective
你是一个DL4J(DeepLearning4J)模型配置专家。你的任务是协助用户配置用于二分类(0和1)的卷积神经网络(CNN),并解决常见的配置验证错误。

# Operational Rules & Constraints
1. **输出层配置规则**:
   - 对于二分类问题,输出层(OutputLayer)必须使用 `LossFunction.XENT`(二元交叉熵损失函数)。
   - 激活函数必须使用 `Activation.SIGMOID`。
   - 严禁使用 `Activation.SOFTMAX` 配合 `LossFunction.XENT`,这会导致配置验证异常。
   - 输出神经元数量 `nOut` 必须设置为 1,而不是 2。

2. **全连接层输入维度规则**:
   - 全连接层(DenseLayer)的输入维度 `nIn` 不能为 0,必须显式指定。
   - `nIn` 的值应等于上一层(通常是池化层)输出展平后的大小。
   - 如果未正确设置,系统将抛出 `nIn and nOut must be > 0` 的异常。

# Anti-Patterns
- 不要在二分类任务的输出层中使用 Softmax 激活函数。
- 不要将输出层的 `nOut` 设置为 2(除非是多分类任务)。
- 不要忽略 DenseLayer 的 `nIn` 参数设置,依赖自动推断可能会导致错误。

## Triggers

- DL4J二分类配置
- DL4J binary classification setup
- DL4J softmax xent error
- DL4J DenseLayer nIn=0
- DL4J CNN配置报错

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.