GPT1_0
GPT1_0
全部文章
分类
归档
标签
去牛客网
登录
/
注册
GPT1_0的博客
全部文章
(共25篇)
题解 | 计算准确度分数
import numpy as np def accuracy_score(y_true, y_pred): cnt = 0 for i in range(len(y_true)): if y_true[i] == y_pred[i]: cn...
2025-11-18
0
19
题解 | 单神经元
import math import numpy as np def single_neuron_model(features, labels, weights, bias): X = np.asarray(features,dtype=float) y = np.asarray(l...
2025-11-18
0
21
题解 | softmax激活函数实现
import numpy as np import math def softmax(scores: list[float]) -> list[float]: length = len(scores) probabilities = [] e = math.e ...
2025-11-18
0
24
题解 | 使用梯度下降的线性回归
import numpy as np def linear_regression_gradient_descent(X, y, alpha, iterations): #初始化参数 w = 0.0 b = 0.0 m = len(X) for it in ra...
2025-11-18
0
15
题解 | 按行或列计算平均值
from typing import List, Union import numpy as np def calculate_matrix_mean(matrix: List[List[Union[int, float]]], mode: str) -> List[float]: ...
2025-11-17
0
15
题解 | 重塑矩阵
from typing import List, Tuple, Union import numpy as np def reshape_matrix(a: List[List[Union[int, float]]], new_shape: Tuple[int, int]) -> List...
2025-11-17
0
16
题解 | 清楚姐姐买竹鼠
a,b,x = map(int,input().split()) dan = x%3 ju = x//3 if a<=b/3: min = x*a elif a>b and dan != 0: min = (ju+1)*b elif a>b and dan == ...
2025-11-11
0
17
题解 | 小红的优惠券
n, m = map(int,input().split()) dic = {} for i in range(m): k,v = map(int,input().split()) dic[k] = v new_dic = sorted(dic.items(),key = lambd...
2025-11-11
0
17
题解 | 矩阵转置
from typing import List, Union # 使用 Union 来表示类型可以是 int 或 float def transpose_matrix(a: List[List[Union[int, float]]]) -> List[List[Union[int, floa...
2025-11-10
0
13
题解 | 矩阵和向量的点积
def matrix_vector_dot_product(matrix, vector): # 补全代码 result = -1 m = len(matrix) #行 n = len(matrix[0]) #列 if n == len(vector): ...
2025-11-10
0
19
首页
上一页
1
2
3
下一页
末页