Initial Information
I built a Neural Network Model (Logistic Regression) to classify Lung Cancer based on the patient's (user) symptoms
My dataset is kind of small (only about 276 data)
Here is the illustration for my dataset:
data.head()
GENDER | AGE | SMOKING | YELLOW_FINGERS | ANXIETY | PEER_PRESSURE | CHRONIC DISEASE | FATIGUE | ALLERGY | WHEEZING | ALCOHOL CONSUMING | COUGHING | SHORTNESS OF BREATH | SWALLOWING DIFFICULTY | CHEST PAIN | LUNG_CANCER |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
M | 69 | 1 | 2 | 2 | 1 | 1 | 2 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | YES |
M | 74 | 2 | 1 | 1 | 1 | 2 | 2 | 2 | 1 | 1 | 1 | 2 | 2 | 2 | YES |
F | 59 | 1 | 1 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 2 | 1 | 2 | NO |
M | 63 | 2 | 2 | 2 | 1 | 1 | 1 | 1 | 1 | 2 | 1 | 1 | 2 | 2 | NO |
Here's how I preprocessing the dataset:
- I drop the duplicate data
- I encode the [GENDER] and [LUNG CANCER] value
- I change the 2,1 value to 1,0
- I scale the age feature using StandardScaler()
- I resample the training set using RandomOverSampler().fit_resample
Here's my Neural Network Model:
model = Sequential(
[
Dense(3, activation = 'sigmoid', input_shape=[15]),
Dense(1, activation = 'sigmoid'),
])
model.compile(
loss=tf.keras.losses.BinaryCrossentropy(),
optimizer=tf.keras.optimizers.Adam(learning_rate=0.01),
metrics=['accuracy'])
history = model.fit(X_train, y_train,
epochs=50, batch_size=16,
validation_split=0.2,
shuffle=True)
Here's the Training Result:
Here's the test result:
test_loss, test_acc = model.evaluate(X_test, y_test)
print("Test loss:", test_loss)
print("Test accuracy:", test_acc)
3/3 [==============================] - 0s 4ms/step - loss: 0.1746 - accuracy: 0.9420
Test loss: 0.17462675273418427 Test accuracy: 0.9420289993286133
Here's the confusion matrix and classification report:
precision recall f1-score support
0 0.98 0.95 0.97 60
1 0.73 0.89 0.80 9
accuracy 0.94 69
macro avg 0.86 0.92 0.88 69
weighted avg 0.95 0.94 0.94 69
My QUESTION:
- Is my model result (accuracy) good enough considering I want to build a Cancer Detection app using this model?
- If my model result (accuracy) is not good enough, how could I improve this model? What parameter should I tweak or maybe should I reduce or add the Neural layer?
Note: Please enlighten me, I'm kind of new to Machine Learning :)