# plot the linear model
xs = np.array(lims[:2])
M1 = np.vstack((xs, vecW[1] + vecW[0]*xs))
plotDataAndModel(data, models=[M1], mlegends=['$f(x)$'],
fname=f'data_no_outlier_regression_lsq.{format}')
def predict(x, vecW):
return np.array([x,1]) @ vecW
x = 10
print(f'f({x}) =', predict(x, vecW))
pred = np.array([x, predict(x, vecW)]).reshape([2,1])
plotDataAndModel(data, models=[M1], xtraData=[pred], mlegends=[],
fname=f'data_no_outlier_regression_result_lsq.{format}')