fix:更新算法

This commit is contained in:
吕新雨
2026-02-02 11:22:35 +08:00
parent 814b96edb6
commit 58d17fc39f
27 changed files with 3286 additions and 62 deletions

View File

@@ -33,6 +33,8 @@
* `profile_source``questionnaire`(後續可擴展 `behavior` / `mixed`
* `profile_generated_at`ISO8601 時間戳
* `profile_confidence`= `conf_U``01`
* `profile_answered`:各題是否作答(用于区分“跳过” vs “明确选择”)
* `stage/emotion/context/need``true/false`
`profile_confidence` 建議規則V1.1 默認,可調參):
@@ -42,6 +44,36 @@
* 730 天:線性衰減到 `0.7`
* 30 天以上:`conf_U = 0.5`(除非用戶重新做問卷或有行為信號更新)
#### V1.2:支持“可跳过题目”的画像输出与置信度(工程必读)
> 前提:问卷允许用户跳过任意题目(包括 mom_stage / emotion / context / need
> 目标:保证任何情况下都能生成“可计算的 U”并在不确定时自动降个性化/降风险。
**V1.2 输出原则:**
* **mom_stage 跳过**:按安全策略处理为 `unknown`(即 `U.stage.unknown=1`),同时 `profile_answered.stage=false`
* **emotion 跳过**`U.emotion_score` 置为缺省(建议直接不输出该字段或输出 `null`),同时 `profile_answered.emotion=false`
* **context 跳过**`U.context` 输出为空对象 `{}`,同时 `profile_answered.context=false`
* **need 跳过**`U.need` 输出为空对象 `{}`,同时 `profile_answered.need=false`
> 说明:
>
> * 之所以“mom_stage 跳过也当作 unknown”是为了在 Push 等高风险场景优先保证不冒犯unknown 语义:不希望被母职身份定义)。
> * emotion/context/need 跳过不强行填默认值,避免制造“伪精确画像”;改由推荐算法在打分时走“通用值 + 不确定性惩罚”见「个性化推荐算法规则」V1.2 补充)。
**V1.2 `conf_U` 计算(在 V1.1 时间衰减基础上叠加“作答完整度”):**
定义:
* `conf_time`:按 V1.1 时间衰减得到01
* `answered_count = Σ I[profile_answered.* = true]`,总题数 `total_questions = 4`
* `completion = answered_count / total_questions`
* `completion_factor = 0.5 + 0.5 * completion`(答得越少越不确定,但仍保留基础信息)
则:
* `conf_U = clamp(conf_time * completion_factor, 0.2, 1.0)`
> Push 推送時若 `conf_U` 偏低,推薦系統需啟用 `P_uncertainty` 並限制 `personalization_power` 上限見「個性化推薦算法規則」V1.1)。
---
@@ -70,6 +102,7 @@
>
> * `mom_stage` 是「身份 / 階段」,不是強度,不做連續軸線
> * `unknown` 的語義是:**不希望被母職身份定義**(不是「沒有孩子」)
> * 若该题被跳过:按安全策略输出 `unknown`,同时 `profile_answered.stage=false`
### 推送原則(高層)
@@ -96,7 +129,7 @@
| Calm | emotion: calm | 0.8 |
| Joyful | emotion: joyful | 1.0 |
生成:`U.emotion_score ∈ [0,1]`
生成:`U.emotion_score ∈ [0,1]`;若该题跳过则输出 `null`(或不输出该字段),并通过 `profile_answered.emotion=false` 表示“未作答”
### 語義說明
@@ -126,6 +159,8 @@
| ----------------------------------------------------- | ----- |
| U.ctx.family / work / relationship / friends / health | 1 或 0 |
> 若该题被跳过:`U.context` 输出为空对象 `{}`,同时 `profile_answered.context=false`
### 語義說明
* context **不是情緒**,而是情緒的「觸發場景」
@@ -153,6 +188,8 @@
| ------------------------------------------------------------------------------------------ | ----- |
| U.need.emotional_support / parenting_pressure / self_worth / anxiety_relief / rest_balance | 1 或 0 |
> 若该题被跳过:`U.need` 输出为空对象 `{}`,同时 `profile_answered.need=false`
### 語義說明
* `need`**推薦權重最高的維度**
@@ -164,11 +201,12 @@
以下規則在推薦時 **優先於任何分數計算**
### 核心禁推規則V1
### 核心禁推規則V1.2
1. **mom_stage = unknown**
* ❌ 禁推:`need: parenting_pressure`(強指向
* ❌ 禁推:**高个性化**育儿压力内容(避免“把她当妈妈/正在育儿”对话
* 判定条件与推荐算法一致V1.2`Cᵢ.need_suitability[parenting_pressure]=1``Cᵢ.personalization_power=1`
2. **mom_stage = parenting**
@@ -192,6 +230,12 @@
"profile_source": "questionnaire",
"profile_generated_at": "2026-01-30T00:00:00Z",
"profile_confidence": 1.0,
"profile_answered": {
"stage": true,
"emotion": true,
"context": true,
"need": true
},
"stage": {
"expecting": 0,
"parenting": 1,
@@ -207,6 +251,31 @@
}
```
### 跳过题目时的输出示例V1.2
> 示例:用户跳过 emotion / context / needmom_stage 也跳过。
```json
{
"profile_version": "v1.2",
"profile_source": "questionnaire",
"profile_generated_at": "2026-01-30T00:00:00Z",
"profile_confidence": 0.5,
"profile_answered": {
"stage": false,
"emotion": false,
"context": false,
"need": false
},
"stage": {
"unknown": 1
},
"emotion_score": null,
"context": {},
"need": {}
}
```
---
## 八、設計總結給產品工程AI Reviewer