Multilayer Perceptron Neural network for binary classification between two type of breast cancer ("benign" and "malignant" )using Wisconsin Breast Cancer Database
WRITTEN BY MOHAMMAD ASADOLAHI
[email protected]
to do:
deploy the project with tensorflow and pytorch for tutorial purposes
python Multilayer perceptron Neural network for predicting patients cancer type data set of project: https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+%28Original%29
train size:
450 sample to train the model
test size:
250 sample to test the model
training method:
Gradient descent - stochastic gradient descent (SGD)
activation function:
Sigmoid (all layers) "all hidden layer activation functions can be replaced with tand-h or ReLU (no improvement for this particular project)"
epoch: 1 accuracy is 0.3413654618473896
epoch: 2 accuracy is 0.3413654618473896
epoch: 3 accuracy is 0.7068273092369478
epoch: 4 accuracy is 0.751004016064257
epoch: 5 accuracy is 0.7630522088353414
epoch: 6 accuracy is 0.7791164658634538
epoch: 7 accuracy is 0.7791164658634538
epoch: 8 accuracy is 0.7871485943775101
epoch: 9 accuracy is 0.7951807228915663
epoch: 10 accuracy is 0.7951807228915663
epoch: 11 accuracy is 0.8032128514056225
epoch: 12 accuracy is 0.8032128514056225
epoch: 13 accuracy is 0.8032128514056225
epoch: 14 accuracy is 0.8032128514056225
epoch: 15 accuracy is 0.8112449799196787
epoch: 16 accuracy is 0.8112449799196787
epoch: 17 accuracy is 0.8112449799196787
epoch: 18 accuracy is 0.8152610441767069
epoch: 19 accuracy is 0.8192771084337349
epoch: 20 accuracy is 0.8273092369477911
epoch: 21 accuracy is 0.8313253012048193
epoch: 22 accuracy is 0.8353413654618473
epoch: 23 accuracy is 0.8393574297188755
epoch: 24 accuracy is 0.8433734939759037
epoch: 25 accuracy is 0.8514056224899599
epoch: 26 accuracy is 0.8554216867469879
epoch: 27 accuracy is 0.8634538152610441
epoch: 28 accuracy is 0.8714859437751004
epoch: 29 accuracy is 0.8795180722891566
epoch: 30 accuracy is 0.8835341365461847
epoch: 31 accuracy is 0.8875502008032129
epoch: 32 accuracy is 0.891566265060241
epoch: 33 accuracy is 0.891566265060241
epoch: 34 accuracy is 0.891566265060241
epoch: 35 accuracy is 0.891566265060241
epoch: 36 accuracy is 0.891566265060241
epoch: 37 accuracy is 0.8955823293172691
epoch: 38 accuracy is 0.8955823293172691
epoch: 39 accuracy is 0.8995983935742972
epoch: 40 accuracy is 0.9036144578313253
epoch: 41 accuracy is 0.9036144578313253
epoch: 42 accuracy is 0.9116465863453815
epoch: 43 accuracy is 0.9156626506024096
epoch: 44 accuracy is 0.9156626506024096
epoch: 45 accuracy is 0.9317269076305221
epoch: 46 accuracy is 0.9477911646586346
epoch: 47 accuracy is 0.9477911646586346
epoch: 48 accuracy is 0.9518072289156626
epoch: 49 accuracy is 0.9518072289156626
epoch: 50 accuracy is 0.9598393574297188
epoch: 51 accuracy is 0.963855421686747
epoch: 52 accuracy is 0.963855421686747
epoch: 53 accuracy is 0.963855421686747
epoch: 54 accuracy is 0.9678714859437751
epoch: 55 accuracy is 0.9678714859437751
epoch: 56 accuracy is 0.9678714859437751
epoch: 57 accuracy is 0.9678714859437751
epoch: 58 accuracy is 0.9678714859437751
epoch: 59 accuracy is 0.9718875502008032
epoch: 60 accuracy is 0.9718875502008032
epoch: 61 accuracy is 0.9718875502008032
epoch: 62 accuracy is 0.9718875502008032
epoch: 63 accuracy is 0.9759036144578314
epoch: 64 accuracy is 0.9759036144578314
epoch: 65 accuracy is 0.9759036144578314
epoch: 66 accuracy is 0.9759036144578314
epoch: 67 accuracy is 0.9759036144578314
epoch: 68 accuracy is 0.9759036144578314
epoch: 69 accuracy is 0.9759036144578314
epoch: 70 accuracy is 0.9718875502008032
epoch: 71 accuracy is 0.9718875502008032
epoch: 72 accuracy is 0.9718875502008032
epoch: 73 accuracy is 0.9759036144578314
epoch: 74 accuracy is 0.9759036144578314
epoch: 75 accuracy is 0.9759036144578314
epoch: 76 accuracy is 0.9759036144578314
epoch: 77 accuracy is 0.9759036144578314
epoch: 78 accuracy is 0.9759036144578314
epoch: 79 accuracy is 0.9759036144578314
epoch: 80 accuracy is 0.9759036144578314
epoch: 81 accuracy is 0.9759036144578314
epoch: 82 accuracy is 0.9759036144578314
epoch: 83 accuracy is 0.9759036144578314
epoch: 84 accuracy is 0.9759036144578314
epoch: 85 accuracy is 0.9759036144578314
epoch: 86 accuracy is 0.9759036144578314
epoch: 87 accuracy is 0.9759036144578314
epoch: 88 accuracy is 0.9718875502008032
epoch: 89 accuracy is 0.9718875502008032
epoch: 90 accuracy is 0.9718875502008032
epoch: 91 accuracy is 0.9718875502008032
epoch: 92 accuracy is 0.9718875502008032
epoch: 93 accuracy is 0.9718875502008032
epoch: 94 accuracy is 0.9718875502008032
epoch: 95 accuracy is 0.9718875502008032
epoch: 96 accuracy is 0.9718875502008032
epoch: 97 accuracy is 0.9718875502008032
epoch: 98 accuracy is 0.9718875502008032
epoch: 99 accuracy is 0.9718875502008032
epoch: 100 accuracy is 0.9718875502008032
model accuracy during epoch 1 to 100
using NN to predict 10 sample from test records:
sample: [0.4 0.1 0.1 0.3 0.1 0.1 0.2 0.1 0.1] predicted class: 0 real calss: 0.0
sample: [0.5 0.1 0.1 0.1 0.2 0.1 0.1 0.1 0.1] predicted class: 0 real calss: 0.0
sample: [0.3 0.1 0.1 0.3 0.2 0.1 0.1 0.1 0.1] predicted class: 0 real calss: 0.0
sample: [0.4 0.5 0.5 0.8 0.6 1. 1. 0.7 0.1] predicted class: 1 real calss: 1.0
sample: [0.2 0.3 0.1 0.1 0.3 0.1 0.1 0.1 0.1] predicted class: 0 real calss: 0.0
sample: [1. 0.2 0.2 0.1 0.2 0.6 0.1 0.1 0.2] predicted class: 1 real calss: 1.0
sample: [1. 0.6 0.5 0.8 0.5 1. 0.8 0.6 0.1] predicted class: 1 real calss: 1.0
sample: [0.8 0.8 0.9 0.6 0.6 0.3 1. 1. 0.1] predicted class: 1 real calss: 1.0
sample: [0.5 0.1 0.2 0.1 0.2 0.1 0.1 0.1 0.1] predicted class: 0 real calss: 0.0
sample: [0.5 0.1 0.3 0.1 0.2 0.1 0.1 0.1 0.1] predicted class: 0 real calss: 0.0