|
7 | 7 | Y0 = np.loadtxt("input/W0.txt", dtype=float)
|
8 | 8 | N, M = MM.shape
|
9 | 9 |
|
10 |
| -# Convert to DataFrames for display |
11 |
| -# df_X = pd.DataFrame(X, columns=[f"Comp_{i+1}" for i in range(X.shape[1])]) |
12 |
| -# df_Y = pd.DataFrame(Y, columns=[f"Sample_{i+1}" for i in range(Y.shape[1])]) |
13 |
| -# df_MM = pd.DataFrame(MM, columns=[f"Sample_{i+1}" for i in range(MM.shape[1])]) |
14 |
| -# df_Y0 = pd.DataFrame(Y0, columns=[f"Sample_{i+1}" for i in range(Y0.shape[1])]) |
15 |
| - |
16 |
| -# Print the matrices |
17 |
| -""" |
18 |
| -print("Feature Matrix (X):\n", df_X, "\n") |
19 |
| -print("Coefficient Matrix (Y):\n", df_Y, "\n") |
20 |
| -print("Data Matrix (MM):\n", df_MM, "\n") |
21 |
| -print("Initial Guess (Y0):\n", df_Y0, "\n") |
22 |
| -""" |
23 |
| - |
24 |
| - |
25 |
| -my_model = snmf_class.SNMFOptimizer(MM=MM, Y0=Y0, X0=X0, A=A0, components=2) |
| 10 | +my_model = snmf_class.SNMFOptimizer(MM=MM, Y0=Y0, X0=X0, A=A0, n_components=2) |
26 | 11 | print("Done")
|
27 |
| -# print(f"My final guess for X: {my_model.X}") |
28 |
| -# print(f"My final guess for Y: {my_model.Y}") |
29 |
| -# print(f"Compare to true X: {X_norm}") |
30 |
| -# print(f"Compare to true Y: {Y_norm}") |
31 | 12 | np.savetxt("my_norm_X.txt", my_model.X, fmt="%.6g", delimiter=" ")
|
32 | 13 | np.savetxt("my_norm_Y.txt", my_model.Y, fmt="%.6g", delimiter=" ")
|
33 | 14 | np.savetxt("my_norm_A.txt", my_model.A, fmt="%.6g", delimiter=" ")
|
0 commit comments