新建仓库维护数据预测项目

This commit is contained in:
13151580307
2025-10-17 14:59:16 +08:00
commit 516126d2a5
72 changed files with 82332 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
import torch
# 构建超定方程组 Ax=b (3方程2未知数)
A = torch.tensor([[2.0, 3], [1, 4], [3, 1]]) # 3x2矩阵
b = torch.tensor([5.0, 6, 4]).reshape(-1,1) # 3x1向量
# 解法1正规方程 (A^T A)^-1 A^T b
solution = torch.linalg.lstsq(A, b).solution # PyTorch内置最小二乘
print(f"最小二乘解:\n{solution.numpy()}")