From 3ddcbb20640e25a822229c835bcd386cda8922df Mon Sep 17 00:00:00 2001 From: Ultraman <2900311815@qq.com> Date: Sun, 3 Nov 2024 17:18:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20function.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- function.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/function.py b/function.py index bfd96c4..fa1a8dc 100644 --- a/function.py +++ b/function.py @@ -2,9 +2,30 @@ import numpy as np import os from sklearn.preprocessing import StandardScaler # 导入标准化库 -# 学号和姓名 +""" +实验说明: +- 自行编写实现数据加载与预测病马死亡的对率回归算法。 + +注意事项: +- 在 function.py 中实现对率回归算法。 +- 可以自行导入其他库,需要在 requirements.txt 添加依赖,若未在 requirements.txt 中添加使用到的依赖,则无法自动评测,成绩为零。 +- 自动评测脚本仅会加载 train_logreg、predict_logreg 和 load_data 函数,请勿修改函数名。 + +测评环境: +- CPU: Intel Xeon(R) CPU E3-1231 v3 @ 3.40GHz +- OS: Ubuntu 22.04.4 LTS +- Python: 3.10.12 +- numpy: 2.1.1 +""" + + +""" +请在这里填写学号和姓名,不填写即成绩无效。 +姓名请直接**填写中文** +例如: name = "张三" +""" id = "202210423220" -name = "方子涵" +name = "方子涵 def sigmoid(z): """计算sigmoid函数""" @@ -65,7 +86,7 @@ def load_data(filepath): labels = np.array(labels) num_features = data.shape[1] - indices_to_remove = [2] # 去掉特征3(索引2) + indices_to_remove = [2] # 去掉特征3(索引2) if num_features > 23: indices_to_remove.extend(range(23, min(28, num_features)))