How to build correct dataset for ann classifier?
I have x signals each with 5000 rows. Each signal x has its own one output in range from 1 to 6 (categories). So for example signal x1 has output 2, signal x2 has output 1.
How can I build X and Y datasets which will work fine with ann classification model. I was thinking to stack those x signals vertically in one column and the other column would be output values (third table bellow) but I do not know if this is right way.
EDITED (added image of signal):
* I have x signals from x sensors which are running simultaneously.
* Each signal represents weight of the truck (sensors are putted under the bridge to measure weight of the truck) where peaks mean number of axles of the truck (number of axles is my output (1 - 6 axles)). See picture below (signal x1 has 2 peaks meaning 2 axles):
Signals x:
| x1 | x2 | x3 | x4 | ... | |-----|-----|-----|-----|-----| | 0.1 | 0.7 | 1.3 | 1.9 | ... | | 0.2 | 0.8 | 1.4 | 2.0 | ... | | 0.3 | 0.9 | 1.5 | 2.1 | ... | | 0.4 | 1.0 | 1.6 | 2.2 | ... 392
| | 0.5 | 1.1 | 1.7 | 2.3 | ... | | 0.6 | 1.2 | 1.8 | 2.4 | ... | | ... | ... | ... | ... | ... |
Outputs:
| y | |---| | 1 | | 2 | | 3 | | 4 |
|...|
Potential dataset (I used only x1 and x2 for simplicity):
| x | y | |-----|---| | 0.1 | 1 | | 0.2 | 1 | | 0.3 | 1 | | 0.4 | 1 | | 0.5 | 1 | | 0.6 | 1 | | ... |...| | 0.7 | 2 | | 0.8 | 2 | | 0.9 | 2 | | 1.0 | 2 | | 1.1 | 2 | | 1.2 | 2 | | ... |...|
ann classifier:
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size = 0.3)
# Initialising ANN
<PERSON> = tf.keras.models.Sequential()
# Adding First Hidden Layer
ann.add(tf.keras.layers.Dense(units = 5000, activation = "relu"))
# Adding Second Hidden Layer
ann.add(tf.keras.layers.Dense(units = 256, activation = "relu"))
# Adding Output Layer
ann.add(tf.keras.layers.Dense(units = 5, activation = 'softmax'))
# Compiling ANN
ann.compile(optimizer = "adam", loss = 'categorical_crossentropy', metrics = ['accuracy'])
# Fitting ANN
X_train = np.array(X_train)
Y_train = np.array(Y_train)
ann.fit(X_train, Y_train, batch_size = 32, epochs = 100) 856