signals_train = signals_train.reshape( (-1, signals_train.shape[2], 1)) #(179,18,1024,1) signals_test = signals_test.reshape((-1, signals_test.shape[2], 1)) # signals_train = signals_train.reshape((signals_train.shape[0], signals_train.shape[1], signals_train.shape[2], 1)) #(179,18,1024,1) # signals_test = signals_test.reshape((signals_test.shape[0], signals_test.shape[1], signals_test.shape[2], 1)) print(signals_test.shape) # print(signals_train[0,0]) # plt.imshow(signals_train[0,0], cmap=plt.cm.Reds) # plt.show() # plt.plot(signals_train[0,0]) # plt.show() # exit() # Load, Reshape and Binarize labels labels_train = LabelEncoder().fit_transform(labels_train.flatten()) labels_test = LabelEncoder().fit_transform(labels_test.flatten()) print(labels_train.shape) print(labels_test.shape) model = Autoencoder() model.fit(signals_train, n_epochs=1, learning_rate=0.003, batch_size=64, load=False, save=True, name='1/CAE_class') # Best: CAE4.2 (256,128);CAE4.2.ld (4,1);
'https://archive.ics.uci.edu/ml/machine-learning-databases/car/car.data', header=None) df.columns = [ 'buying', 'maint', 'doors', 'persons', 'lug_boot', 'safety', 'target' ] df.head() from sklearn.preprocessing import LabelEncoder # Get the feature vector # Implement me X = df.iloc[:, :-1].values # Encode the feature vector using one-hot-encoding # Implement me X = LabelEncoder().fit_transform(X.flatten()).reshape(X.shape) # Get the target vector # Implement me y = df['target'].values # Encode the target vector # Implement me le = LabelEncoder() y = le.fit_transform(y) # Randomly choose 30% of the data for testing (set randome_state as 0 and stratify as y) # Implement me X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3,