作业6 线性 岭回归 多项式

This commit is contained in:
veypi 2021-01-17 05:14:17 +08:00
parent 633e4ab5ed
commit 4ba30640fb

View File

@ -8,7 +8,11 @@ from sklearn.preprocessing import PolynomialFeatures
def f1(x, e): def f1(x, e):
return math.exp(-x) * math.sin(x) \ return math.exp(-x) * math.sin(x) \
+ random.normalvariate(0, e ** 2) + random.normalvariate(0, e)
def f2(x, y, e):
return math.exp(-x ** 2 - y ** 2) * math.sin(x * y) + random.normalvariate(0, e)
def solve1(x, y): def solve1(x, y):