MCPcopy Index your code
hub / github.com/VivekPa/AIAlpha / encode_data

Method encode_data

models/autoencoder.py:50–62  ·  view source on GitHub ↗
(self, data, csv_path, save_csv=True)

Source from the content-addressed store, hash-verified

48 print(model.evaluate(test_data, test_data))
49
50 def encode_data(self, data, csv_path, save_csv=True):
51 coded_train = []
52 for i in range(len(data)):
53 curr_data = np.array(data.iloc[i, :])
54 values = np.reshape(curr_data, (1, 1, self.input_shape))
55 coded = self.encoder.predict(values)
56 shaped = np.reshape(coded, (20,))
57 coded_train.append(shaped)
58
59 train_coded = pd.DataFrame(coded_train, index=np.arange(len(coded_train)), columns=np.arange(20))
60 if save_csv:
61 train_coded.to_csv(f"{csv_path}")
62 return train_coded
63

Callers 2

run.pyFile · 0.80
pca_auto.pyFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected