# Application of Deep Learning to Construct Breast Cancer Diagnosis Model
## 2 Materials and Methods
### Research Framework
#### 2.1.2 Back Propagation Network (BPN)  
Step1. Determining the network architecture  
This includes variables that determine the input and output layers, select the number of hidden layers, neurons in the hidden layer, and the activation function. 1. Input layer: Generally, data that are about to enter the input layer need to be pre-processed to reduce possible prediction errors caused by different data units. After the data were preprocessed by normalization, the weight adjustment rate of the data should be similar to avoid weight dispersion. Additionally, the number of neural processing units depends on the problem, and the number of neurons in the input layer of this study is the number of attributes of the cancer data used. Figure 1: Breast cancer risk factor model. (The dotted lines on the top are the first phase of the model were the BPN and SVM are applied to the dataset. The second dotted lines at the bottom are the second phase of the recognition model where the deep learning networks and the single and majority voting are applied). 2. Output layer: The output layer represents the output variables of the network, and the number of neural processing units depends on the problem. According to this research, the output was set to benign and malignant. 3. Hidden layer: The hidden layer represents the interaction between the neural processing units of the input layer. In this study, the hidden layer represents the interaction between the input and output layers. The computation of the hidden layers, the number of neurons, and the activation function were determined here. 1. Number of hidden layers: A neural network with one hidden layer can approximate the most complex functions with the required accuracy [23]. Therefore, this study sets the hidden layers to one. 2. The number of neurons in the hidden layer: if the number of neurons in the hidden layer is too small, it will not be enough to construct a nonlinear relationship between the output and the input, leading to an error, but overfitting may occur if it exceeds a certain number. Studies have pointed out that the number of neurons in the hidden layer can be set using either Equation (1) or (2). 3. Activation Function: the primary function of the activation function is to convert the output value of the function into the output of the processing unit. In this study, a sigmoid function, as shown in Equation (3) was used. This function converts the output value to a value between zero and one. 4. 5.2. Finding the best parameter combination 1. Learning Rate and momentum: the learning rate is mainly used to control the magnitude of the weight each time it changes. If it is too large or too small, it may negatively impact the network in ways such as (1), causing the model to converge too quickly to a suboptimal solution or (2) causing the process to jam. Therefore, in this study, we set a large initial value (e.g., 0.01) for the learning rate, and then gradually reduce it during the training process, to strike a balance between speeding up the convergence and avoiding the oscillation. This concept is also known as decaying learning rate as shown in Equation (4). 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99.  
where \(N\) is the total number of samples, \(\hat{y_{i}}\) is the predicted value of the \(i\)th sample, and \(y_{i}\) is the actual value of the \(i\)th sample. In this study, the convergence criteria were based on the highest Accuracy Rate for selecting the best network architecture and parameter combination was the first priority and the test sample with the smallest MSE value was the second priority. 3. Support Vector Machine (SVM): is a machine learning method published by [PERSON] in 1995 [PERSON] and [PERSON] (1995).