Decision Trees — Structured Decision-Making
Decision tree analysis: a visual tool for making decisions with probabilities and expected value.
When to Use
✅ Good for:
- - Business decisions (investments, hiring, product launches)
- Personal choices (career, relocation, purchases)
- Trading & investing (position sizing, entry/exit)
- Operational decisions (expansion, outsourcing)
- Any situation with measurable consequences
❌ Not suitable for:
- - Decisions with true uncertainty (black swans)
- Fast tactical choices
- Purely emotional/ethical questions
Method
Decision tree = tree-like structure where:
- - Decision nodes (squares) — your actions
- Chance nodes (circles) — random events
- End nodes (triangles) — final outcomes
Process:
- 1. Define options — all possible actions
- Define outcomes — what can happen after each action
- Estimate probabilities — how likely is each outcome (0-100%)
- Estimate values — utility/reward for each outcome (money, points, utility units)
- Calculate EV — expected value = Σ (probability × value)
- Choose — option with highest EV
Formula
CODEBLOCK0
Example:
- - Outcome A: 70% probability, +$100 → 0.7 × 100 = $70
- Outcome B: 30% probability, -$50 → 0.3 × (-50) = -$15
- EV = $70 + (-$15) = $55
Classic Example (from Wikipedia)
Decision: Go to party or stay home?
Estimates:
- - Party: +9 utility (fun)
- Home: +3 utility (comfort)
- Carrying jacket unnecessarily: -2 utility
- Being cold: -10 utility
- Probability cold: 70%
- Probability warm: 30%
Tree:
CODEBLOCK1
Conclusion: Go and take jacket (EV = 8.4) > stay home (EV = 3.0) > go without jacket (EV = 2.0)
Business Example
Decision: Launch new product?
Estimates:
- - Success probability: 40%
- Failure probability: 60%
- Profit if success: $500K
- Loss if failure: $200K
- Don't launch: $0
Tree:
CODEBLOCK2
Conclusion: Launch (EV = +$80K) is better than not launching ($0).
Trading Example
Decision: Enter position or wait?
Estimates:
- - Probability of rise: 60%
- Probability of fall: 40%
- Position size: $1000
- Target: +10% ($100 profit)
- Stop-loss: -5% ($50 loss)
Tree:
CODEBLOCK3
Conclusion: Entering position has positive EV (+$40), better than waiting ($0).
Method Limitations
⚠️ Critical points:
- 1. Subjective estimates — probabilities often "finger in the air"
- Doesn't account for risk appetite — ignores psychology (loss aversion)
- Simplified model — reality is more complex
- Unstable — small data changes can drastically alter the tree
- May be inaccurate — other methods exist that are more precise (random forests)
But: The method is valuable for structuring thinking, even if numbers are approximate.
User Workflow
1. Structuring
Ask:
- - What are the action options?
- What are possible outcomes?
- What are values/utility for each outcome?
- How do we measure value? (money, utility units, happiness points)
2. Probability Estimation
Help estimate through:
- - Historical data (if available)
- Comparable situations
- Expert judgment (user experience)
- Subjective assessment (if no data)
3. Visualization
Draw tree in markdown:
CODEBLOCK4
4. EV Calculation
For each option:
CODEBLOCK5
5. Recommendation
Option with highest EV = best choice (rationally).
But add context:
- - Risk tolerance (can user handle worst case)
- Time horizon (when is result needed)
- Other factors (reputational risk, emotions, ethics)
Application Examples by Domain
Trading & Investing
Position Sizing:
- - Options: 5%, 10%, 20% of capital
- Outcomes: Profit/loss with different probabilities
- Value: Absolute profit in $
Entry Timing:
- - Options: Enter now, wait for -5%, wait for -10%
- Outcomes: Price goes up/down
- Value: Opportunity cost vs better entry price
Business Strategy
Product Launch:
- - Options: Launch / don't launch
- Outcomes: Success / failure
- Value: Revenue, market share, costs
Hiring Decision:
- - Options: Hire candidate A / candidate B / don't hire
- Outcomes: Successful onboarding / quit after X months
- Value: Productivity, costs, opportunity cost
Personal Decisions
Career Change:
- - Options: Stay / change job / start business
- Outcomes: Success / failure in new role
- Value: Salary, satisfaction, growth, risk
Real Estate:
- - Options: Buy house A / house B / continue renting
- Outcomes: Price increase / decrease / personal situation changes
- Value: Net worth, monthly costs, quality of life
Operations
Capacity Planning:
- - Options: Expand production / outsource / status quo
- Outcomes: Demand increases / decreases
- Value: Profit, utilization, fixed costs
Vendor Selection:
- - Options: Vendor A / Vendor B / in-house
- Outcomes: Quality, reliability, failures
- Value: Total cost of ownership
Calculator Script
Use scripts/decision_tree.py for automated EV calculations:
CODEBLOCK6
Or via JSON:
CODEBLOCK7
JSON format:
CODEBLOCK8
Output:
CODEBLOCK9
Final Checklist
Before giving recommendation, ensure:
- - ✅ All options covered
- ✅ Probabilities sum to 100% for each branch
- ✅ Values are realistic (not fantasies)
- ✅ Worst case scenario is clear to user
- ✅ Risk/reward ratio is explicit
- ✅ Method limitations mentioned
- ✅ Qualitative context added (not just EV)
Method Advantages
✅ Simple — people understand trees intuitively
✅ Visual — clear structure
✅ Works with little data — can use expert estimates
✅ White box — transparent logic
✅ Worst/best case — extreme scenarios visible
✅ Multiple decision-makers — can account for different interests
Method Disadvantages
❌ Unstable — small data changes → large tree changes
❌ Inaccurate — often more precise methods exist
❌ Subjective — probability estimates "from the head"
❌ Complex — becomes unwieldy with many outcomes
❌ Doesn't account for risk preference — assumes risk neutrality
Important
The method is valuable for structuring thinking, but numbers are often taken from thin air.
What matters more is the process — forcing yourself to think through all branches and explicitly evaluate consequences.
Don't sell the decision as "scientifically proven" — it's just a framework for conscious choice.
Further Reading
- - Decision trees in operations research
- Influence diagrams (more compact for complex decisions)
- Utility functions (accounting for risk aversion)
- Monte Carlo simulation (for greater accuracy)
- Real options analysis (for strategic decisions)
决策树——结构化决策
决策树分析:一种利用概率和期望值进行决策的可视化工具。
何时使用
✅ 适用场景:
- - 商业决策(投资、招聘、产品发布)
- 个人选择(职业、搬迁、购物)
- 交易与投资(仓位管理、入场/出场)
- 运营决策(扩张、外包)
- 任何具有可衡量后果的情境
❌ 不适用场景:
- - 真正的不确定性决策(黑天鹅事件)
- 快速战术选择
- 纯粹的情感/伦理问题
方法
决策树 = 树状结构,其中:
- - 决策节点(方形)——你的行动
- 机会节点(圆形)——随机事件
- 终节点(三角形)——最终结果
流程:
- 1. 定义选项——所有可能的行动
- 定义结果——每个行动后可能发生的情况
- 估算概率——每个结果的可能性(0-100%)
- 估算价值——每个结果的效用/回报(金钱、分数、效用单位)
- 计算期望值——期望值 = Σ(概率 × 价值)
- 选择——期望值最高的选项
公式
EV = Σ (概率i × 价值i)
示例:
- - 结果A:70%概率,+100美元 → 0.7 × 100 = 70美元
- 结果B:30%概率,-50美元 → 0.3 × (-50) = -15美元
- EV = 70 + (-15) = 55美元
经典示例(来自维基百科)
决策: 去派对还是待在家?
估算:
- - 派对:+9效用(有趣)
- 在家:+3效用(舒适)
- 不必要地携带夹克:-2效用
- 感到寒冷:-10效用
- 寒冷概率:70%
- 温暖概率:30%
树状图:
决策
├─ 去派对
│ ├─ 带夹克
│ │ ├─ 寒冷 (70%) → 9效用(派对)
│ │ └─ 温暖 (30%) → 9 - 2 = 7效用(不必要携带)
│ │ EV = 0.7 × 9 + 0.3 × 7 = 8.4
│ └─ 不带夹克
│ ├─ 寒冷 (70%) → 9 - 10 = -1效用(冻着了)
│ └─ 温暖 (30%) → 9效用(完美)
│ EV = 0.7 × (-1) + 0.3 × 9 = 2.0
└─ 待在家
└─ EV = 3.0(始终)
结论: 去派对并带夹克(EV = 8.4)> 待在家(EV = 3.0)> 去派对不带夹克(EV = 2.0)
商业示例
决策: 发布新产品?
估算:
- - 成功概率:40%
- 失败概率:60%
- 成功利润:50万美元
- 失败损失:20万美元
- 不发布:0美元
树状图:
发布产品
├─ 成功 (40%) → +50万美元
└─ 失败 (60%) → -20万美元
EV = (0.4 × 50万) + (0.6 × -20万) = 20万 - 12万 = +8万美元
不发布
└─ EV = 0美元
结论: 发布(EV = +8万美元)优于不发布(0美元)。
交易示例
决策: 入场还是等待?
估算:
- - 上涨概率:60%
- 下跌概率:40%
- 仓位规模:1000美元
- 目标:+10%(100美元利润)
- 止损:-5%(50美元损失)
树状图:
入场
├─ 上涨 (60%) → +100美元
└─ 下跌 (40%) → -50美元
EV = (0.6 × 100) + (0.4 × -50) = 60 - 20 = +40美元
等待
└─ 无仓位 → 0美元
EV = 0美元
结论: 入场具有正期望值(+40美元),优于等待(0美元)。
方法局限性
⚠️ 关键点:
- 1. 主观估算——概率往往是凭空猜测
- 未考虑风险偏好——忽略心理学(损失厌恶)
- 简化模型——现实更为复杂
- 不稳定——数据微小变化可能导致树状图大幅改变
- 可能不准确——存在更精确的其他方法(随机森林)
但是: 该方法对于结构化思考很有价值,即使数字是近似值。
用户工作流程
1. 结构化
提问:
- - 有哪些行动选项?
- 可能的结果是什么?
- 每个结果的价值/效用是多少?
- 我们如何衡量价值?(金钱、效用单位、幸福指数)
2. 概率估算
通过以下方式帮助估算:
- - 历史数据(如有)
- 类似情境
- 专家判断(用户经验)
- 主观评估(如无数据)
3. 可视化
用Markdown绘制树状图:
决策
├─ 选项A
│ ├─ 结果A1 (X%) → 价值Y
│ └─ 结果A2 (Z%) → 价值W
└─ 选项B
└─ 结果B1 (100%) → 价值V
4. 期望值计算
对于每个选项:
EV_A = (X% × Y) + (Z% × W)
EV_B = V
5. 建议
期望值最高的选项 = 最佳选择(理性上)。
但需补充背景信息:
- - 风险承受能力(用户能否承受最坏情况)
- 时间范围(何时需要结果)
- 其他因素(声誉风险、情感、伦理)
按领域划分的应用示例
交易与投资
仓位管理:
- - 选项:资本的5%、10%、20%
- 结果:不同概率下的盈利/亏损
- 价值:绝对利润(美元)
入场时机:
- - 选项:立即入场、等待-5%、等待-10%
- 结果:价格上涨/下跌
- 价值:机会成本 vs 更优入场价格
商业策略
产品发布:
- - 选项:发布/不发布
- 结果:成功/失败
- 价值:收入、市场份额、成本
招聘决策:
- - 选项:录用候选人A/候选人B/不录用
- 结果:成功入职/X个月后离职
- 价值:生产力、成本、机会成本
个人决策
职业变更:
- - 选项:留任/换工作/创业
- 结果:新岗位成功/失败
- 价值:薪资、满意度、成长、风险
房地产:
- - 选项:购买房屋A/房屋B/继续租房
- 结果:价格上涨/下跌/个人情况变化
- 价值:净资产、月度成本、生活质量
运营管理
产能规划:
- - 选项:扩大生产/外包/维持现状
- 结果:需求增加/减少
- 价值:利润、利用率、固定成本
供应商选择:
- - 选项:供应商A/供应商B/内部自营
- 结果:质量、可靠性、故障
- 价值:总拥有成本
计算器脚本
使用 scripts/decision_tree.py 进行自动期望值计算:
bash
python3 scripts/decision_tree.py --interactive
或通过JSON:
bash
python3 scripts/decision_tree.py --json tree.json
JSON格式:
json
{
decision: 发布产品?,
options: [
{
name: 发布,
outcomes: [
{name: 成功, probability: 0.4, value: 500000},
{name: 失败, probability: 0.6, value: -200000}
]
},
{
name: 不发布,
outcomes: [
{name: 维持现状, probability: 1.0, value: 0}
]
}
]
}
输出:
📊 决策树分析
决策:发布产品?
选项1:发布
└─ EV = 80,000.00美元
├─ 成功 (40.0%) → +500,000.00美元
└─ 失败 (60.0%) → -200,000.00美元
选项2:不发布
└─ EV = 0.00美元
└─ 维持现状 (100.0%)