|
import numpy as np
import pandas as pd
def write_file_for_tfjs(name, data):
with open(name + '.txt', 'w') as outfile:
outfile.write('# shape: {0}\n'.format(data.shape))
for data_slice in data.values:
data_slice = np.array(data_slice, dtype=np.float64)
np.savetxt(outfile, data_slice.reshape(1, -1), fmt='%.18e')
outfile.write('# New slice\n')
# Load your data into your custom DataFrame
x_train = pd.DataFrame([1, 2, 3, 5, 6, 7])
y_train = pd.DataFrame([9, 8, 7, 6, 5, 4])
write_file_for_tfjs("x", x_train)
write_file_for_tfjs("y", y_train)
:
?
:
x* =
W =
b =
f(\textbf{x}; \textbf{W}, b) =
\textbf{x}* = \mathrm{argmax}_xf(\textbf{x}; \textbf{W}, b)
?