I've seen a couple questions that have a similar problem, but none of them solved mine. I'm trying to fit a neural network in Keras to a dataset with 22 input features for binary classification. The problem is that I only have 195 training samples. I know it's a small dataset, but I don't know if it's possible to fit a model with reasonable accuracy (I'm aiming for >95% accuracy). The problem I'm having is that my model is only outputting 1 and getting 75% accuracy because my dataset is 75% positive cases. Here's the code I have:
data = pd.read_csv("") #filename omitted, but it loads properly scaler = MinMaxScaler() X = scaler.fit_transform(X) Y = data['status'] X = data.drop(['status', 'name'], axis = 1) xTrain, xTest, yTrain, yTest = train_test_split(X, Y, train_size = 0.8) model = Sequential() model.add(Dense(48, input_shape=(22,), activation = 'relu')) model.add(Dropout(0.5)) model.add(Dense(1, activation = 'softmax')) optim = keras.optimizers.adam(lr=0.0001) model.compile(optimizer = optim, loss = 'binary_crossentropy', metrics = ['accuracy']) model.fit(xTrain, yTrain, epochs = 20, batch_size = 5, validation_data = (xTest, yTest))
I've tried adding more hidden layers, increasing the number of training epochs, and increased and lowered the optimizer's learning rate, but the accuracy stays the same. Here's the link to the dataset: https://www.dropbox.com/s/c4td650b4z7aizc/fixed.xlsx?dl=0
EDIT: I fixed my problem by applying SMOTE to balance my dataset. The accuracy went up to 96% after I did this and added more hidden layers.