@jeremy,
I am Tursun, a student in Malaysia. I have seen your posts in another thread. But I think this thread is right place.
I have this multi-class classification problem.
my data : tursun.csv , available to download from here :
size of my data set : 512*16, last column is 21 classes, they are digits 1-21 (so maybe OneHotEncoding is not needed)
note: number of samples (rows in my data) for each class is different. mostly 20 rows, but sometimes 17 or 31 rows
my network has:
first layer (input) has 15 neurons
second layer (hidden) has 30 neurons
last layer (output) has 21 neurons
in last layer I used “softmax” based on this recommendatins from
https://github.com/fchollet/keras/issues/1013
"The softmax function transforms your hidden units into probability scores of the class labels you have; and thus is more suited to classification problems "
I got error message when execute it in Keras in Anaconda in Ubuntu 16.04:
alueError: Error when checking model target: expected dense_8 to have shape (None, 21) but got array with shape (512, 1)
------------- keras code ----------
from keras.models import Sequential
from keras.layers import Dense
import numpy
fix random seed for reproducibility
numpy.random.seed(7)
load pima indians dataset
dataset = numpy.loadtxt(“tursun_deep_p6.csv”, delimiter=",")
split into input (X) and output (Y) variables
X = dataset[:,0:15]
Y = dataset[:,15]
create model
model = Sequential()
model.add(Dense(30, input_dim=15, activation=‘relu’))
#model.add(Dense(25, activation=‘relu’)) # want to add another hidden layer, can I?
model.add(Dense(21, activation=‘softmax’))
Compile model
model.compile(loss=‘categorical_crossentropy’, optimizer=‘adam’, metrics=[‘accuracy’])
Fit the model
model.fit(X, Y, epochs=150, batch_size=5)
evaluate the model
scores = model.evaluate(X, Y)
print("\n%s: %.2f%%" % (model.metrics_names[1], scores[1]*100))
-------------keras code end ----
I have following questions:
- can I use CNN, RNN for this multi class classification problem (I know DBN is YES. One thing about DBN, quite hard to find code example in anywhere, somebody claims DBN is old method back to 2006,then what is good method for multi class classification excep “ctegorical_crossentropy”)?
I ever used MLP,SVM, KNN,Random Forest for my above database, they are good (MLP , not DL algo).
now I want to use Deep learning methods, I think if I use deep learning, accuracy would not easily drop even data table become big (population increases)
Thank you