Skip to content

Commit c3bd86f

Browse files
committed
updates for fumat
1 parent 5c949b6 commit c3bd86f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/pytuq/lreg/anl.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def _compute_sigmahatsq(self, Amat, y):
5555
"""
5656
npt, nbas = Amat.shape
5757
bp = np.dot(y, y - np.dot(Amat, self.cf))/2.
58+
#bp = np.dot(y- np.dot(Amat, self.cf), y - np.dot(Amat, self.cf))/2.
5859

5960
ap = (npt - nbas)/2.
6061
sigmahatsq = bp/(ap-1.)
@@ -74,12 +75,19 @@ def fita(self, Amat, y):
7475
"""
7576
npt, nbas = Amat.shape
7677

77-
ptp = np.dot(Amat.T, Amat)
78+
ptp = np.matmul(Amat.T, Amat)
7879
if self.prior_var is not None:
7980
ptp += (self.datavar/self.prior_var) * np.eye(nbas)
8081
ptp += self.cov_nugget*np.eye(nbas)
81-
invptp = np.linalg.inv(ptp)
82-
self.cf = np.dot(invptp, np.dot(Amat.T, y))
82+
invptp = np.linalg.pinv(ptp)
83+
invptp = invptp*0.5 + invptp.T*0.5
84+
np.savetxt('invptp2.txt', invptp)
85+
np.savetxt('ptp2.txt', ptp)
86+
Aty = np.matmul(Amat.T, y)
87+
np.savetxt('Aty2.txt', Aty)
88+
89+
90+
self.cf = np.matmul(invptp, Aty)
8391

8492
if self.datavar is None:
8593
sigmahatsq = self._compute_sigmahatsq(Amat, y)

src/pytuq/utils/plotting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ def plot_dm(datas, models, errorbars=None, labels=None, colors=None,
164164
fmt='o', markersize=msize,
165165
markeredgecolor='w',
166166
color=colors[i],
167-
ecolor=colors[i], label=labels[i])
167+
ecolor=colors[i], label=labels[i], alpha=0.5)
168168
else:
169-
plt.plot(ddata[:, j], model, 'o', color=colors[i], label=labels[i], markeredgecolor='w', markersize=msize)
169+
plt.plot(ddata[:, j], model, 'o', color=colors[i], label=labels[i], markeredgecolor='w', markersize=msize, alpha=0.5)
170170

171171
delt = 0.03 * (yy.max() - yy.min())
172172
minmax = [yy.min() - delt, yy.max() + delt]

0 commit comments

Comments
 (0)