из mdn [/g1] https://developer.mozilla.org/en/DOM/element.id
, поэтому я думаю, что лучше быть. ..
Вам необходимо преобразовать Y
в матрицу двоичного класса, используя to_categorical
( документы ).
import sklearn.datasets
X,Y = sklearn.datasets.make_classification(n_samples=100, n_features=6, n_redundant=0,n_informative=6, n_classes=20)
import numpy as np
from keras import Sequential
from keras.layers import Dense
from keras.utils import to_categorical
from keras import backend as K
K.clear_session()
model = Sequential()
model.add(Dense(50,input_dim=X.shape[1],activation='softmax'))
model.add(Dense(20,activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='rmsprop',
metrics=['accuracy'])
model.summary()
model.fit(X, to_categorical(Y), epochs=1000, verbose=1) # <---
Также вы можете использовать sklearn для этого тоже.