From d73552e103d053a652fcaca921a9387b4631f2ff Mon Sep 17 00:00:00 2001 From: 43606070 <43606070@qq.com> Date: Sat, 2 Nov 2024 15:55:33 +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 | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/function.py b/function.py index c1417bc..04cfd7d 100644 --- a/function.py +++ b/function.py @@ -1,13 +1,33 @@ -# 学号和姓名 +import numpy as np + +""" +实验说明: +- 自行编写实现数据加载与预测病马死亡的对率回归算法。 + +注意事项: +- 在 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 +""" + +# 请在这里填写学号和姓名,不填写即成绩无效。 id = "202210423118" name = "刘国庆" + + def load_data(filepath): """ 从文件中加载数据,若不自行正确实现,则无法通过评测,不记录成绩。 Args: - filepath (str): 数据文件路径。 - + Returns: - np.array: 特征数据。 - np.array: 标签数据。 @@ -41,7 +61,6 @@ def load_data(filepath): return None, None - def sigmoid(z): """ Sigmoid activation function.