Python Forum

Full Version: Query about arrays in a neural network
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I have created a simple neural network consisting of a numerical array in an array of size (size) = 192 and shape (shape) = (4, 48) I called it training_data and another array of size (size) = 8 and shape (shape) = (4, 2) I called it target_data. What the model does is that for each row of 48 elements of the training matrix, it corresponds to a row of 2 elements of the target matrix (1 to 1 correspondence).

The model works well, making prediction with different trainig values giving consistent results.

My query is how do I make or can I enter as input data (training_data) into the model not one matrix, but two matrixes? leaving fixed the size of the output matrix (target_data) of (4, 2). What I want is to separate the data from the matrix training (4, 48) into two matrixes of (4, 24).

training_data = np.array([[8,6,8,6.5,7.5,5,8,6.5,9,5.5,6.5,6.5,6,7,8,104,5.5,6,8,5.5,7,6.5,8,6,8.5,4.5,5.5,6,6.5,8,6,97.5,1.4,1,3,0,1,0.3,0,6.7,0.6,0,0,1,2,0,0.3,3.9],[5.5,6,7.5,5.5,7.5,5,8,6.5,9,5.5,6.5,6.5,6,7,7.5,99.5,5,6,8,5.5,7,6.5,8.5,6.5,8.5,6,6,7,6.5,8,7,102,1.5,0,4,0,1,0,0,6.5,0.7,1,0,1,2,0,0.3,4.9],[8,7.5,8,7.5,7.5,7,8.5,7.5,9,8,8.5,7,6,7.5,7.5,115,6,6,7,5,7,6.5,7,6.5,6,5,6,4,6.5,8,7,93.5,1.4,0,4,1,2,0.3,0.3,8.9,0.7,1,0,0,4,0,0,5.7],[7,7.5,6,6.5,7.5,6.5,8.5,6.5,8,5.5,6.5,6.5,6,7.5,7.5,103.5,7.5,8,7,7.5,8,6.5,8.5,6.5,8.5,5.5,6,8,6.5,7.5,7,108.5,1.6,0,5,0,2,0,0,8.6,0.8,1,0,1,4,0.3,0.3,7.3]], "float32")

target_data = np.array([[0.666666666666667,0.333333333333333],[0,0],[1,0.333333333333333],[0.333333333333333,0.333333333333333]], "float32")

model.fit(training_data, target_data, epochs=1000)

cheers,
Github