Skip to content

Commit 3c54016

Browse files
john-halloranJohn Halloran
andauthored
refactor: move optimization out of init and into fit (#170)
* style: per sklearn, attributes learned from data end with underscore * refactor: move optimization out of init and into fit * fix: use new fit() for test * style: end fit() with return self * docs: update docstring to reflect new functionality * refactor: use rho and eta in fit * feat: use reset for sequential refinements * fix: use copies for safety --------- Co-authored-by: John Halloran <jhalloran@oxy.edu>
1 parent de54a43 commit 3c54016

File tree

3 files changed

+118
-89
lines changed

3 files changed

+118
-89
lines changed

src/diffpy/snmf/main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
init_stretch=init_stretch_file,
1616
show_plots=True,
1717
)
18+
my_model.fit(rho=1e12, eta=610)
1819

1920
print("Done")
20-
np.savetxt("my_norm_components.txt", my_model.components, fmt="%.6g", delimiter=" ")
21-
np.savetxt("my_norm_weights.txt", my_model.weights, fmt="%.6g", delimiter=" ")
22-
np.savetxt("my_norm_stretch.txt", my_model.stretch, fmt="%.6g", delimiter=" ")
21+
np.savetxt("my_norm_components.txt", my_model.components_, fmt="%.6g", delimiter=" ")
22+
np.savetxt("my_norm_weights.txt", my_model.weights_, fmt="%.6g", delimiter=" ")
23+
np.savetxt("my_norm_stretch.txt", my_model.stretch_, fmt="%.6g", delimiter=" ")

0 commit comments

Comments
 (0)