{
  "schemaVersion": 1,
  "id": "2.2.5",
  "title": "智能步数预测模型开发与测试",
  "durationMinutes": 20,
  "category": "模型开发与测试",
  "scenario": "随着健康意识的增强，越来越多的人开始使用智能设备跟踪自己的日常活动。准确预测每日步数对于用户来说至关重要，因为它可以帮助他们更好地管理健康状况，设定合理的运动目标，并提高生活质量。现要求根据提供的预处理好的fitness analysis数据集，补全2.2.5.ipynb代码。选择合适的特征，开发一个步数预测模型，对用户未来一段时间内的每日步数进行预测。利用测试工具对模型进行测试，并对测试结果进行分析，完成测试报告，并运用工具对错误原因进行纠正。\n\n（1）正确加载数据集，并显示前五行的数据。\n\n（2）请使用决策树模型，要求设定自变量和因变量（设定daily_steps为目标变量），并根据自变量特征进行模型训练，最终将训练好的模型以文件名2.2.5_model.pkl保存到考生文件夹，结果文件以2.2.5_results.txt保存到考生文件夹。\n\n（3）使用测试工具对模型进行测试，并记录测试结果，命名2.2.5_report.txt，保存到考生文件夹。\n\n（4）对测试结果进行详细分析，并编写测试报告，包括模型性能评估、错误分析及改进建议，将答案写到答题卷文件中，答题卷文件命名为“2.2.5.docx”，保存到考生文件夹。\n\n（5）将以上代码以及运行结果，以html格式保存并命名为2.2.5.html，保存到考生文件夹，考生文件夹命名为“准考证号+身份证后6位”。",
  "skillRequirements": "(1) 能够维护日常训练集与测试集。\n\n(2)能使用工具对算法进行训练。\n\n(3)能够使用测试工具对人工智能产品的使用进行测试。\n\n(4)能够对测试结果进行分析，编写测试报告。\n\n(5)能够运用工具，分析算法中错误案例产生的原因并进行纠正。",
  "qualityIndicators": "(1)深入理解业务，训练符合业务需求的模型。\n\n(2)数据预处理步骤完整，方法选择合理。\n\n(3)代码实现正确，结果符合预期。\n\n(4)测试结果分析全面，报告详细",
  "tasks": [
    {
      "id": "code-fill",
      "type": "code-fill",
      "title": "补全代码任务",
      "instructions": "依据公开题面和附件补全代码空位；仅检查完成度与提交格式，不公开标准内容。",
      "codeBlocks": [
        "import pandas as pd\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.tree import DecisionTreeRegressor\nimport pickle\nfrom sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score\n\n# 加载数据集\ndf = __________\n\n# 显示前五行数据\nprint(__________)\n\n# 选择相关特征进行建模\nX = df[['Your gender ', 'How important is exercise to you ?', 'How healthy do you consider yourself?']]\nX = __________(X)  # 将分类变量转为数值变量\n\n# 设置目标变量\ny = __________  \n\n# 将数据集划分为训练集和测试集（测试集占20%）\nX_train, X_test, y_train, y_test = __________(__________, random_state=42)\n\n# 创建并训练决策树回归模型\n__________ = __________(random_state=42)\n# 训练决策树回归模型\n__________\n\n# 保存训练好的模型\nwith open('2.2.5_model.pkl', 'wb') as model_file:\n    pickle.__________\n\n# 进行预测\ny_pred = __________\n\n# 将结果保存到文本文件中\nresults = pd.DataFrame({'实际值': y_test, '预测值': y_pred})\nresults_filename = '2.2.5_results.txt'\n__________(__________, index=False, sep='\\t')  \n\n# 将测试结果保存到报告文件中\nreport_filename = '2.2.5_report.txt'\nwith open(__________) as f:\n    f.write(f'均方误差: {__________}\\n')\n    f.write(f'平均绝对误差: {__________}\\n')\n    f.write(f'决定系数: {__________}\\n')",
        ""
      ],
      "blanks": [
        {
          "id": "blank-1",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-2",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-3",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-4",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-5",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-6",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-7",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-8",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-9",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-10",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-11",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-12",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-13",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-14",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-15",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-16",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-17",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        }
      ]
    },
    {
      "id": "2-2-response",
      "type": "rubric-response",
      "title": "模型开发与测试报告",
      "instructions": "说明模型开发、测试和结果评价过程。",
      "sections": [
        {
          "id": "response",
          "label": "作答内容"
        }
      ],
      "rubric": [
        {
          "id": "criterion-1",
          "label": "数据划分与特征处理合理",
          "weight": 25
        },
        {
          "id": "criterion-2",
          "label": "模型选择和训练过程清晰",
          "weight": 25
        },
        {
          "id": "criterion-3",
          "label": "测试指标与题目目标匹配",
          "weight": 25
        },
        {
          "id": "criterion-4",
          "label": "包含误差分析、复现和改进建议",
          "weight": 25
        }
      ]
    },
    {
      "id": "artifact-submission",
      "type": "artifact-submission",
      "title": "选择结果文件",
      "instructions": "文件仅在本机选择并校验，不上传，也不持久化文件内容。",
      "items": [
        {
          "id": "artifact-1",
          "label": "提交文件：2.2.5_model.pkl",
          "filename": "2.2.5_model.pkl",
          "extensions": [
            ".pkl"
          ],
          "minCount": 1,
          "maxCount": 1,
          "maxSize": 104857600
        },
        {
          "id": "artifact-2",
          "label": "提交文件：2.2.5_results.txt",
          "filename": "2.2.5_results.txt",
          "extensions": [
            ".txt"
          ],
          "minCount": 1,
          "maxCount": 1,
          "maxSize": 104857600
        },
        {
          "id": "artifact-3",
          "label": "提交文件：2.2.5.docx",
          "filename": "2.2.5.docx",
          "extensions": [
            ".docx"
          ],
          "minCount": 1,
          "maxCount": 1,
          "maxSize": 104857600
        },
        {
          "id": "artifact-4",
          "label": "提交文件：2.2.5.html",
          "filename": "2.2.5.html",
          "extensions": [
            ".html"
          ],
          "minCount": 1,
          "maxCount": 1,
          "maxSize": 104857600
        }
      ]
    }
  ],
  "attachments": [
    {
      "name": "2.2.5.docx",
      "url": "assets/2.2.5/2.2.5.docx",
      "size": 15019,
      "sha256": "ad752a4a3d9758e3d3443193898e9df5b7fa9d6fc7e7b50bc9915000b79b5774",
      "mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    },
    {
      "name": "2.2.5.ipynb",
      "url": "assets/2.2.5/2.2.5.ipynb",
      "size": 2495,
      "sha256": "41b0e844c9e0784e721e99c8220e4be6fddfc446dabb1c15b959ec025450dd34",
      "mime": "application/x-ipynb+json"
    },
    {
      "name": "2.2.5.md",
      "url": "assets/2.2.5/2.2.5.md",
      "size": 2363,
      "sha256": "43e207663263f72013d1373f1da21381db9069aac3be10fdc9b55e3b04088476",
      "mime": "text/markdown"
    },
    {
      "name": "fitness analysis.csv",
      "url": "assets/2.2.5/fitness analysis.csv",
      "size": 149669,
      "sha256": "d1b18b5115bc4ef833b6cc00c4bda1bf5223c65c1ec5f3ace0cc8900e00e28e3",
      "mime": "text/csv"
    }
  ],
  "grading": {
    "mode": "completion-and-format-only"
  },
  "review": {
    "status": "approved",
    "notice": "由公开题面通用生成，未使用答案树。",
    "conflicts": []
  },
  "contentVersion": "72b53f0dfe92ebb7"
}
