How to enter data in Keras? In particular, what are x_train and y_train if I have more than two columns?

How can I enter data in keras? What is the structure? In particular, what are x_train and y_train if I have more than two columns?

This is the data I want to enter:

enter image description here

I am trying to define Xtrain in this example. It contains the multi-server code of Neural Network Perceptron. ( http://keras.io/examples/ ) Here is the code:

from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD

model = Sequential()
model.add(Dense(64, input_dim=20, init='uniform'))
model.add(Activation('tanh'))
model.add(Dropout(0.5))
model.add(Dense(64, init='uniform'))
model.add(Activation('tanh'))
model.add(Dropout(0.5))
model.add(Dense(2, init='uniform'))
model.add(Activation('softmax'))

sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='mean_squared_error', optimizer=sgd)

model.fit(X_train, y_train, nb_epoch=20, batch_size=16)
score = model.evaluate(X_test, y_test, batch_size=16)

EDIT (additional information):

Take a look here: What is the data type for the Python Keras deep learning package?

Keras numpy, theano.config.floatX. .theanorc. , float64 CPU float32 , float32 CPU, .

X = numpy.zeros((4,3), dtype=theano.config.floatX)

: 1 , numpy , excel. ?

+4
1

.

, , A-N. input_dim 14, X_train (N, 14) numpy, :

[
   [9278,  37.9, ...],
   [18594, 36.3, ...],
   ...
]

, 2 (2 LOL), Y_train (N, 2) numpy :

[
   [1, 0],
   [1, 0],
   ...
   [0, 1],
   [0, 1],
   ...
]

[1,0] , .

+10

Source: https://habr.com/ru/post/1621578/


All Articles