"““AI产品类型判断器:基于特征权重为产品分类””" def classify_product(features): "““features: dict, 产品各项特征得分,取值范围0-10””" scores = {"assistant": 0.0, "tool": 0.0, "platform": 0.0, "native": 0.0} weights = { "conversation_level": {"assistant": 8, "tool": 2, "platform": 1, "native": 5}, "task_focus": {"assistant": 2, "tool": 9, "platform": 3, "native": 4}, "developer_service": {"assistant": 1, "tool": 2, "platform": 10, "native": 2}, "experience_reinvent": {"assistant": 3, "tool": 2, "platform": 2, "native“: 9}, } for feat, value in features.items(): if feat not in weights: continue for ptype, w in weights[feat].items(): scores[ptype] += value * w best = max(scores, key=scores.get) return best, scores def main(): examples = [ (“智能客服机器人”, {”conversation_level": 9, "task_focus": 3, "developer_service": 2, "experience_reinvent“: 2}), (“AI抠图工具”, {”conversation_level": 1, "task_focus": 10, "developer_service": 1, "experience_reinvent“: 4}), (“开放模型API平台”, {”conversation_level": 2, "task_focus": 3, "developer_service": 10, "experience_reinvent“: 3}), (“生成式短视频应用”, {”conversation_level": 4, "task_focus": 5, "developer_service": 2, "experience_reinvent“: 9}), ] for name, feats in examples: best, scores = classify_product(feats) print(“产品:%s -> 类型:%s” % (name, best)) print(“ 得分:%s” % {k: round(v, 1) for k, v in scores.items()}) if name == ”main": main() ```
代码用途:根据产品的四项特征(对话能力、任务聚焦、开发者服务、体验重构)加权打分,自动判断它属于四类AI产品中的哪一类,帮助产品经理快速完成类型体检。