Learn practical skills, build real-world projects, and advance your career
Created 5 years ago
PyTorch进阶之路(二):如何实现线性回归
yield_apple = w11 * temp + w12 * rainfall + w13 * humidity + b1
yield_orange = w21 * temp + w22 * rainfall + w23 * humidity + b2
可视化地看,这意味着苹果或橙子的产量是温度、降雨量或湿度的线性函数或平面函数:
import torch
import numpy as np
#input (temp温度 , rainfall降雨量, humidity湿度 )
inputs = np.array([[73, 67, 43],[91, 88, 64],[87, 134, 58],[102, 43, 37], [69, 96, 70]], dtype='float32')
inputs
array([[ 73., 67., 43.],
[ 91., 88., 64.],
[ 87., 134., 58.],
[102., 43., 37.],
[ 69., 96., 70.]], dtype=float32)