我正在尝试编写一个程序,该程序将询问一系列问题,以便最终返回建议。我该怎么办?
我尝试使用树,但无法正确完成。
例如,这可以是一系列:
Q : Is the care damaged fully?
A : No
Q : How bad is the damage? [Totaled | Average | Light]
A : Average
Q : Is it able to start?
A : No
Q : Is it towable?
A : Y
.
.
.
.
Okay, recommended service plan : [name of package]
答案 0 :(得分:0)
这似乎是作业或作业的编码问题,所以我将不提供编码解决方案。您可以尝试if
else
个条件来实现这一点。使用嵌套的if
条件应该非常简单。您也可以为此使用switch
case
。
如果您将数据保存在csv或文本文件中,并且被允许使用ML库,则可以训练模型并以代码形式从中提取树规则。