def test_orthogonals(): dist = cp.Iid(cp.Normal(), dim) cp.orth_gs(order, dist) cp.orth_ttr(order, dist) cp.orth_chol(order, dist)
_=plt.xticks([]) poly = cp.orth_chol(polynomial_order, n, normed=True) print('Cholesky decomposition {}'.format(poly)) ax = plt.subplot(222) ax.set_title('Cholesky decomposition') _=plt.plot(x, poly(x).T) _=plt.xticks([]) poly = cp.orth_ttr(polynomial_order, n, normed=True) print('Discretized Stieltjes / Thre terms reccursion {}'.format(poly)) ax = plt.subplot(223) ax.set_title('Discretized Stieltjes ') _=plt.plot(x, poly(x).T) poly = cp.orth_gs(polynomial_order, n, normed=True) print('Modified Gram-Schmidt {}'.format(poly)) ax = plt.subplot(224) ax.set_title('Modified Gram-Schmidt') _=plt.plot(x, poly(x).T) # end example orthogonalization schemes # _Linear Regression_ # linear regression in chaospy cp.fit_regression? # end linear regression in chaospy # example linear regression # 1. define marginal and joint distributions u1 = cp.Uniform(0,1)