we get an overall score and model accuracy of %as depicted in figure - which is really amazingin spite of low samples of red winewe seem to do pretty well in case your models do not perform well on other datasets due to class imbalance problemyou can consider over-sampling or under-sampling techniques including sample selection as well as smote coming back to our classification problemwe have really good modelbut can we do betterwhile that seems to be far-fetched dreamlet' try modeling the data using fully connected deep neural network (dnnwith three hidden layers refer to the "newer supervised deep learning modelssection in to refresh your memory on fully-connected dnns and mlps deep learning frameworks like keras on top of tensorflow prefer if your output response labels are encoded to numeric forms which are easier to work with the following snippet encodes our wine type class labels in [ ]le labelencoder(le fit(wtp_train_yencode wine type labels wtp_train_ey le transform(wtp_train_ywtp_test_ey le transform(wtp_test_ylet' build the architecture for our three-hidden layer dnn where each hidden layer has units (the input layer has units for the featuresand the output layer has unit to predict or which maps back to red or white wine in [ ]from keras models import sequential from keras layers import dense wtp_dnn_model sequential(wtp_dnn_model add(dense( activation='relu'input_shape=( ,))wtp_dnn_model add(dense( activation='relu')wtp_dnn_model add(dense( activation='relu')wtp_dnn_model add(dense( activation='sigmoid')wtp_dnn_model compile(loss='binary_crossentropy'optimizer='adam'metrics=['accuracy']using tensorflow backend you can see that we are using keras on top of tensorflowand for our optimizerwe have chosen the adam optimizer with binary cross-entropy loss you can also use categorical cross-entropy if neededwhich is especially useful when you have more than two classes the following snippet helps train our dnn in [ ]history wtp_dnn_model fit(wtp_train_sxwtp_train_eyepochs= batch_size= shuffle=truevalidation_split= verbose= train on samplesvalidate on samples epoch / / loss acc val_loss val_acc epoch / / loss acc val_loss val_acc epoch / / loss acc val_loss val_acc epoch / / loss acc val_loss val_acc we use of the training data for validation set while training the model to see how it performs at each epoch let' now predict and evaluate our model on the actual test dataset